﻿using System;
using Microsoft.EntityFrameworkCore.Migrations;

namespace Mt.Site.Migrations
{
    public partial class initTable2023 : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.CreateTable(
                name: "AbpPersistedGrants",
                columns: table => new
                {
                    Id = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: false),
                    Type = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
                    SubjectId = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: true),
                    SessionId = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
                    ClientId = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: false),
                    Description = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: true),
                    CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    Expiration = table.Column<DateTime>(type: "datetime2", nullable: true),
                    ConsumedTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    Data = table.Column<string>(type: "nvarchar(max)", maxLength: 50000, nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_AbpPersistedGrants", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "AppAccessData",
                columns: table => new
                {
                    Id = table.Column<long>(type: "bigint", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    Acount = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: true),
                    IsNewVisitor = table.Column<int>(type: "int", nullable: false),
                    SessionId = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: true),
                    ClientIp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: true),
                    UserAgent = table.Column<string>(type: "nvarchar(640)", maxLength: 640, nullable: true),
                    Title = table.Column<string>(type: "nvarchar(300)", maxLength: 300, nullable: true),
                    Url = table.Column<string>(type: "nvarchar(300)", maxLength: 300, nullable: true),
                    RefererUrl = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: true),
                    CookieEnabled = table.Column<bool>(type: "bit", nullable: false),
                    Resolution = table.Column<string>(type: "nvarchar(20)", maxLength: 20, nullable: true),
                    ColorDepth = table.Column<string>(type: "nvarchar(10)", maxLength: 10, nullable: true),
                    WindowHeight = table.Column<int>(type: "int", nullable: false),
                    CultureName = table.Column<string>(type: "nvarchar(10)", maxLength: 10, nullable: true),
                    BrowserFamily = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
                    Browser = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
                    OSFamily = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
                    OS = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
                    Device = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
                    FormFactor = table.Column<int>(type: "int", nullable: false),
                    Region = table.Column<string>(type: "nvarchar(20)", maxLength: 20, nullable: true),
                    City = table.Column<string>(type: "nvarchar(20)", maxLength: 20, nullable: true),
                    ISP = table.Column<string>(type: "nvarchar(20)", maxLength: 20, nullable: true),
                    SourceType = table.Column<int>(type: "int", nullable: false),
                    IsExternalLinks = table.Column<int>(type: "int", nullable: false),
                    IsSearchEngines = table.Column<int>(type: "int", nullable: false),
                    EngineName = table.Column<string>(type: "nvarchar(10)", maxLength: 10, nullable: true),
                    Searchkey = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
                    EngineType = table.Column<string>(type: "nvarchar(10)", maxLength: 10, nullable: true),
                    VisitTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    Year = table.Column<int>(type: "int", nullable: false),
                    Month = table.Column<int>(type: "int", nullable: false),
                    Day = table.Column<int>(type: "int", nullable: false),
                    Hour = table.Column<int>(type: "int", nullable: false),
                    Week = table.Column<int>(type: "int", nullable: false),
                    SundayFormart = table.Column<string>(type: "nvarchar(10)", maxLength: 10, nullable: true),
                    DayFormart = table.Column<string>(type: "nvarchar(10)", maxLength: 10, nullable: true),
                    MonthFormart = table.Column<string>(type: "nvarchar(10)", maxLength: 10, nullable: true),
                    RouteData = table.Column<string>(type: "nvarchar(300)", maxLength: 300, nullable: true),
                    TenancyName = table.Column<string>(type: "nvarchar(10)", maxLength: 10, nullable: true),
                    MenuId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    Lv1MenuId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    LengthOfStay = table.Column<int>(type: "int", nullable: false),
                    TimeTotol = table.Column<long>(type: "bigint", nullable: false),
                    PageNum = table.Column<int>(type: "int", nullable: false),
                    FrequentVisits = table.Column<int>(type: "int", nullable: false),
                    LastVisitTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    IsFistPage = table.Column<int>(type: "int", nullable: false),
                    IsBounced = table.Column<int>(type: "int", nullable: false),
                    IsEndPage = table.Column<int>(type: "int", nullable: false),
                    IsSecondPage = table.Column<bool>(type: "bit", nullable: false),
                    FirstPageUrl = table.Column<string>(type: "nvarchar(300)", maxLength: 300, nullable: true),
                    FirstPageVisitTime = table.Column<DateTime>(type: "datetime2", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_AppAccessData", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "AppAccessGeneral",
                columns: table => new
                {
                    Id = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    LastVisitedDate = table.Column<DateTime>(type: "datetime2", nullable: true),
                    StartTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    HasImportIpData = table.Column<bool>(type: "bit", nullable: false),
                    Pv_TotolNum = table.Column<long>(type: "bigint", nullable: false),
                    Uv_TotolNum = table.Column<long>(type: "bigint", nullable: false),
                    Ip_TotolNum = table.Column<long>(type: "bigint", nullable: false),
                    New_TotolNum = table.Column<long>(type: "bigint", nullable: false),
                    Tiaochu_TotolNum = table.Column<long>(type: "bigint", nullable: false),
                    LengthOfStay_Totol = table.Column<long>(type: "bigint", nullable: false),
                    Pv_Max_InADay = table.Column<long>(type: "bigint", nullable: false),
                    Pv_Max_InADay_Date = table.Column<DateTime>(type: "datetime2", nullable: true),
                    Uv_Max_InADay = table.Column<long>(type: "bigint", nullable: false),
                    Uv_Max_InADay_Date = table.Column<DateTime>(type: "datetime2", nullable: true),
                    Ip_Max_InADay = table.Column<long>(type: "bigint", nullable: false),
                    Ip_Max_InADay_Date = table.Column<DateTime>(type: "datetime2", nullable: true),
                    Tiaochu_Max_InADay = table.Column<long>(type: "bigint", nullable: false),
                    Tiaochu_Max_InADay_Date = table.Column<DateTime>(type: "datetime2", nullable: true),
                    New_Max_InADay = table.Column<long>(type: "bigint", nullable: false),
                    New_Max_InADay_Date = table.Column<DateTime>(type: "datetime2", nullable: true),
                    LengthOfStay_Max_InADay = table.Column<long>(type: "bigint", nullable: false),
                    LengthOfStay_Max_InADay_Date = table.Column<DateTime>(type: "datetime2", nullable: true),
                    Pv_Today = table.Column<long>(type: "bigint", nullable: false),
                    Uv_Today = table.Column<long>(type: "bigint", nullable: false),
                    Ip_Today = table.Column<long>(type: "bigint", nullable: false),
                    New_Today = table.Column<long>(type: "bigint", nullable: false),
                    Tiaochu_Today = table.Column<long>(type: "bigint", nullable: false),
                    LengthOfStay_Today = table.Column<long>(type: "bigint", nullable: false),
                    Pv_Month = table.Column<long>(type: "bigint", nullable: false),
                    Uv_Month = table.Column<long>(type: "bigint", nullable: false),
                    Ip_Month = table.Column<long>(type: "bigint", nullable: false),
                    New_Month = table.Column<long>(type: "bigint", nullable: false),
                    Tiaochu_Month = table.Column<long>(type: "bigint", nullable: false),
                    LengthOfStay_Month = table.Column<long>(type: "bigint", nullable: false),
                    Pv_Yestoday = table.Column<long>(type: "bigint", nullable: false),
                    Uv_Yestoday = table.Column<long>(type: "bigint", nullable: false),
                    Ip_Yestoday = table.Column<long>(type: "bigint", nullable: false),
                    New_Yestoday = table.Column<long>(type: "bigint", nullable: false),
                    Tiaochu_Yestoday = table.Column<long>(type: "bigint", nullable: false),
                    LengthOfStay_Yestoday = table.Column<long>(type: "bigint", nullable: false),
                    Pv_Year = table.Column<long>(type: "bigint", nullable: false),
                    Uv_Year = table.Column<long>(type: "bigint", nullable: false),
                    Ip_Year = table.Column<long>(type: "bigint", nullable: false),
                    New_Year = table.Column<long>(type: "bigint", nullable: false),
                    Tiaochu_Year = table.Column<long>(type: "bigint", nullable: false),
                    LengthOfStay_Year = table.Column<long>(type: "bigint", nullable: false),
                    TenancyName = table.Column<string>(type: "nvarchar(10)", maxLength: 10, nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_AppAccessGeneral", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "AppBackEndModules",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    IsActive = table.Column<bool>(type: "bit", nullable: false),
                    Name = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: true),
                    DisplayName = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
                    Description = table.Column<string>(type: "nvarchar(250)", maxLength: 250, nullable: true),
                    Icon = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
                    Url = table.Column<string>(type: "nvarchar(300)", maxLength: 300, nullable: true),
                    Target = table.Column<string>(type: "nvarchar(20)", maxLength: 20, nullable: true),
                    Order = table.Column<int>(type: "int", nullable: false),
                    CustomData = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: true),
                    CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    CreatorUserId = table.Column<long>(type: "bigint", nullable: true),
                    LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    LastModifierUserId = table.Column<long>(type: "bigint", nullable: true),
                    IsDeleted = table.Column<bool>(type: "bit", nullable: false),
                    DeleterUserId = table.Column<long>(type: "bigint", nullable: true),
                    DeletionTime = table.Column<DateTime>(type: "datetime2", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_AppBackEndModules", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "AppBackupBody",
                columns: table => new
                {
                    Id = table.Column<long>(type: "bigint", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    ContentId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    Value = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    FieldName = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_AppBackupBody", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "AppBackupField",
                columns: table => new
                {
                    Id = table.Column<long>(type: "bigint", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    ContentId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    Value = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: true),
                    FieldName = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_AppBackupField", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "AppBinaryObjects",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    TenantId = table.Column<int>(type: "int", nullable: true),
                    Description = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Bytes = table.Column<byte[]>(type: "varbinary(max)", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_AppBinaryObjects", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "AppCommonShortMsg",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    ReplyMsg = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
                    CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    CreatorUserId = table.Column<long>(type: "bigint", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_AppCommonShortMsg", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "AppContent",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    TenantId = table.Column<int>(type: "int", nullable: false),
                    MenuId = table.Column<long>(type: "bigint", nullable: false),
                    Language = table.Column<string>(type: "nvarchar(10)", maxLength: 10, nullable: true),
                    AuxiliaryId = table.Column<long>(type: "bigint", nullable: false),
                    IsActive = table.Column<bool>(type: "bit", nullable: false),
                    Key = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
                    Hit = table.Column<int>(type: "int", nullable: false),
                    PublishTime = table.Column<long>(type: "bigint", nullable: false),
                    Title = table.Column<string>(type: "nvarchar(350)", maxLength: 350, nullable: true),
                    Body = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Body2 = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Time1 = table.Column<long>(type: "bigint", nullable: false),
                    Time2 = table.Column<long>(type: "bigint", nullable: false),
                    Time3 = table.Column<long>(type: "bigint", nullable: false),
                    Time4 = table.Column<long>(type: "bigint", nullable: false),
                    Str1 = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: true),
                    Str2 = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: true),
                    Str3 = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: true),
                    Str4 = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: true),
                    Str5 = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: true),
                    Str6 = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: true),
                    Str7 = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: true),
                    Str8 = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: true),
                    Str9 = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: true),
                    Str10 = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: true),
                    Str11 = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: true),
                    Str12 = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: true),
                    Str13 = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: true),
                    Str14 = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: true),
                    Str15 = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: true),
                    Bool1 = table.Column<bool>(type: "bit", nullable: false),
                    Bool2 = table.Column<bool>(type: "bit", nullable: false),
                    Bool3 = table.Column<bool>(type: "bit", nullable: false),
                    Bool4 = table.Column<bool>(type: "bit", nullable: false),
                    Int1 = table.Column<int>(type: "int", nullable: false),
                    Int2 = table.Column<int>(type: "int", nullable: false),
                    Int3 = table.Column<int>(type: "int", nullable: false),
                    Int4 = table.Column<int>(type: "int", nullable: false),
                    Int5 = table.Column<int>(type: "int", nullable: false),
                    Double1 = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
                    Double2 = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
                    Double3 = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
                    Double4 = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
                    AutoSynchronous = table.Column<bool>(type: "bit", nullable: false),
                    SourceID = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    Order = table.Column<int>(type: "int", nullable: false),
                    IsHomeRecommend = table.Column<bool>(type: "bit", nullable: false),
                    RelateId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    Discriminator = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
                    CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    CreatorUserId = table.Column<long>(type: "bigint", nullable: true),
                    LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    LastModifierUserId = table.Column<long>(type: "bigint", nullable: true),
                    IsDeleted = table.Column<bool>(type: "bit", nullable: false),
                    DeleterUserId = table.Column<long>(type: "bigint", nullable: true),
                    DeletionTime = table.Column<DateTime>(type: "datetime2", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_AppContent", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "AppContentBody",
                columns: table => new
                {
                    Id = table.Column<long>(type: "bigint", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    ContentId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    Value = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    FieldName = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_AppContentBody", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "AppContentField",
                columns: table => new
                {
                    Id = table.Column<long>(type: "bigint", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    ContentId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    Value = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: true),
                    FieldName = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_AppContentField", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "AppContentMenus",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    MenuId = table.Column<long>(type: "bigint", nullable: false),
                    ContentId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    ManagementType = table.Column<int>(type: "int", nullable: false),
                    EntityTypeName = table.Column<string>(type: "nvarchar(250)", maxLength: 250, nullable: false),
                    RelateId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    Order = table.Column<int>(type: "int", nullable: false),
                    PublishTime = table.Column<long>(type: "bigint", nullable: false),
                    CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    CreatorUserId = table.Column<long>(type: "bigint", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_AppContentMenus", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "AppContentStorages",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    TenantId = table.Column<int>(type: "int", nullable: false),
                    ContentId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    FileObjectId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    CreatorUserId = table.Column<long>(type: "bigint", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_AppContentStorages", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "AppDataLog",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    DataMenuName = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: true),
                    MenuId = table.Column<long>(type: "bigint", nullable: false),
                    DataId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    DataAuxiliaryId = table.Column<long>(type: "bigint", nullable: false),
                    DataTitle = table.Column<string>(type: "nvarchar(350)", maxLength: 350, nullable: true),
                    OptionType = table.Column<int>(type: "int", nullable: false),
                    TenantId = table.Column<int>(type: "int", nullable: false),
                    Language = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
                    EntityTypeName = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
                    CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    CreatorUserId = table.Column<long>(type: "bigint", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_AppDataLog", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "AppDirectories",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    TenantId = table.Column<int>(type: "int", nullable: false),
                    DisplayName = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
                    Description = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
                    IsDefault = table.Column<bool>(type: "bit", nullable: false),
                    Owners = table.Column<string>(type: "nvarchar(512)", maxLength: 512, nullable: true),
                    ParentId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    Code = table.Column<string>(type: "nvarchar(95)", maxLength: 95, nullable: false),
                    CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    CreatorUserId = table.Column<long>(type: "bigint", nullable: true),
                    LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    LastModifierUserId = table.Column<long>(type: "bigint", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_AppDirectories", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "AppFileLibrary",
                columns: table => new
                {
                    Id = table.Column<long>(type: "bigint", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    FileUrl = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: false),
                    FileName = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
                    Title = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
                    Size = table.Column<long>(type: "bigint", nullable: false),
                    ExName = table.Column<string>(type: "nvarchar(10)", maxLength: 10, nullable: true),
                    Dimensions = table.Column<string>(type: "nvarchar(32)", maxLength: 32, nullable: true),
                    Tags = table.Column<string>(type: "nvarchar(512)", maxLength: 512, nullable: true),
                    DirectoryId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    Sha1 = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
                    CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    CreatorUserId = table.Column<long>(type: "bigint", nullable: true),
                    LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    LastModifierUserId = table.Column<long>(type: "bigint", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_AppFileLibrary", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "AppFileObjectEx",
                columns: table => new
                {
                    Id = table.Column<long>(type: "bigint", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    OriginFileUrl = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
                    FileUrl = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
                    Sha1 = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
                    Dimensions = table.Column<string>(type: "nvarchar(32)", maxLength: 32, nullable: true),
                    Size = table.Column<long>(type: "bigint", nullable: false),
                    ExName = table.Column<string>(type: "nvarchar(10)", maxLength: 10, nullable: true),
                    Alias = table.Column<string>(type: "nvarchar(20)", maxLength: 20, nullable: true),
                    CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    CreatorUserId = table.Column<long>(type: "bigint", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_AppFileObjectEx", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "AppFileObjects",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    TenantId = table.Column<int>(type: "int", nullable: false),
                    Language = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
                    ContentId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    FileUrl = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: false),
                    PreViewImage = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
                    Description = table.Column<string>(type: "nvarchar(3072)", maxLength: 3072, nullable: true),
                    Size = table.Column<string>(type: "nvarchar(32)", maxLength: 32, nullable: true),
                    FileLength = table.Column<long>(type: "bigint", nullable: false),
                    FileName = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
                    exName = table.Column<string>(type: "nvarchar(10)", maxLength: 10, nullable: true),
                    CTR = table.Column<int>(type: "int", nullable: false),
                    Title = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
                    LinkUrl = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
                    Alt = table.Column<string>(type: "nvarchar(512)", maxLength: 512, nullable: true),
                    Alias = table.Column<string>(type: "nvarchar(20)", maxLength: 20, nullable: true),
                    Order = table.Column<int>(type: "int", nullable: false),
                    Scoure = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
                    IsActive = table.Column<bool>(type: "bit", nullable: false),
                    AutoSynchronous = table.Column<bool>(type: "bit", nullable: false),
                    SourceID = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    IsTemporary = table.Column<bool>(type: "bit", nullable: false),
                    IsFromLibrary = table.Column<bool>(type: "bit", nullable: false),
                    Sha1 = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
                    CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    CreatorUserId = table.Column<long>(type: "bigint", nullable: true),
                    LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    LastModifierUserId = table.Column<long>(type: "bigint", nullable: true),
                    IsDeleted = table.Column<bool>(type: "bit", nullable: false),
                    DeleterUserId = table.Column<long>(type: "bigint", nullable: true),
                    DeletionTime = table.Column<DateTime>(type: "datetime2", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_AppFileObjects", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "AppFrontEndPages",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    Name = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
                    Description = table.Column<string>(type: "nvarchar(250)", maxLength: 250, nullable: true),
                    BackEndModuleId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    ModuleName = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: true),
                    ControllerName = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
                    ActionName = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
                    Url = table.Column<string>(type: "nvarchar(250)", maxLength: 250, nullable: true),
                    Target = table.Column<string>(type: "nvarchar(10)", maxLength: 10, nullable: true),
                    IsActive = table.Column<bool>(type: "bit", nullable: false),
                    Order = table.Column<int>(type: "int", nullable: false),
                    IsDetailPage = table.Column<bool>(type: "bit", nullable: false),
                    IsDefault = table.Column<bool>(type: "bit", nullable: false),
                    DetailPageId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    CreatorUserId = table.Column<long>(type: "bigint", nullable: true),
                    LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    LastModifierUserId = table.Column<long>(type: "bigint", nullable: true),
                    IsDeleted = table.Column<bool>(type: "bit", nullable: false),
                    DeleterUserId = table.Column<long>(type: "bigint", nullable: true),
                    DeletionTime = table.Column<DateTime>(type: "datetime2", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_AppFrontEndPages", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "AppIPInfos",
                columns: table => new
                {
                    Id = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    StartIp = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    EndIp = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    StartDigit = table.Column<long>(type: "bigint", nullable: false),
                    EndDigit = table.Column<long>(type: "bigint", nullable: false),
                    Region = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    City = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    ISP = table.Column<string>(type: "nvarchar(max)", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_AppIPInfos", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "AppMember",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    LoginName = table.Column<string>(type: "nvarchar(20)", maxLength: 20, nullable: true),
                    Password = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
                    Email = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
                    IsTrainingAllowed = table.Column<bool>(type: "bit", nullable: false),
                    IsActive = table.Column<bool>(type: "bit", nullable: false),
                    RegisterForm = table.Column<string>(type: "nvarchar(20)", maxLength: 20, nullable: true),
                    IsReceive = table.Column<bool>(type: "bit", nullable: true),
                    IP = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
                    LoginCount = table.Column<int>(type: "int", nullable: false),
                    FailLoginCount = table.Column<int>(type: "int", nullable: false),
                    FreezeEndTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    LastLoginTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    VerificationCode = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
                    CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    CreatorUserId = table.Column<long>(type: "bigint", nullable: true),
                    LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    LastModifierUserId = table.Column<long>(type: "bigint", nullable: true),
                    IsDeleted = table.Column<bool>(type: "bit", nullable: false),
                    DeleterUserId = table.Column<long>(type: "bigint", nullable: true),
                    DeletionTime = table.Column<DateTime>(type: "datetime2", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_AppMember", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "AppMemberInfo",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    MemberID = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    FirstName = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
                    LastName = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
                    FullName = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
                    Phone = table.Column<string>(type: "nvarchar(15)", maxLength: 15, nullable: true),
                    Sex = table.Column<string>(type: "nvarchar(5)", maxLength: 5, nullable: true),
                    Company = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
                    Tel = table.Column<string>(type: "nvarchar(15)", maxLength: 15, nullable: true),
                    ZipCode = table.Column<string>(type: "nvarchar(10)", maxLength: 10, nullable: true),
                    JobTitle = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
                    Address = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
                    Address1 = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
                    Country = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
                    WebPage = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
                    Province = table.Column<string>(type: "nvarchar(20)", maxLength: 20, nullable: true),
                    City = table.Column<string>(type: "nvarchar(20)", maxLength: 20, nullable: true),
                    Fax = table.Column<string>(type: "nvarchar(15)", maxLength: 15, nullable: true),
                    Remark = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    TenantId = table.Column<int>(type: "int", nullable: false),
                    Language = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
                    CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    CreatorUserId = table.Column<long>(type: "bigint", nullable: true),
                    LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    LastModifierUserId = table.Column<long>(type: "bigint", nullable: true),
                    IsDeleted = table.Column<bool>(type: "bit", nullable: false),
                    DeleterUserId = table.Column<long>(type: "bigint", nullable: true),
                    DeletionTime = table.Column<DateTime>(type: "datetime2", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_AppMemberInfo", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "AppMenuConfigs",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    TenantId = table.Column<int>(type: "int", nullable: false),
                    MenuId = table.Column<long>(type: "bigint", nullable: false),
                    Type = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
                    ExtensionData = table.Column<string>(type: "nvarchar(max)", maxLength: 20480, nullable: true),
                    Description = table.Column<string>(type: "nvarchar(max)", maxLength: 6144, nullable: true),
                    AutoSynchronous = table.Column<bool>(type: "bit", nullable: false),
                    CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    CreatorUserId = table.Column<long>(type: "bigint", nullable: true),
                    LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    LastModifierUserId = table.Column<long>(type: "bigint", nullable: true),
                    IsDeleted = table.Column<bool>(type: "bit", nullable: false),
                    DeleterUserId = table.Column<long>(type: "bigint", nullable: true),
                    DeletionTime = table.Column<DateTime>(type: "datetime2", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_AppMenuConfigs", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "AppMenus",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    ParentId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    DisplayName = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: false),
                    Code = table.Column<string>(type: "nvarchar(95)", maxLength: 95, nullable: false),
                    AuxiliaryId = table.Column<long>(type: "bigint", nullable: false),
                    TenantId = table.Column<int>(type: "int", nullable: false),
                    Order = table.Column<int>(type: "int", nullable: false),
                    DisplayType = table.Column<byte>(type: "tinyint", nullable: false),
                    DeviceType = table.Column<byte>(type: "tinyint", nullable: false),
                    IsActive = table.Column<bool>(type: "bit", nullable: false),
                    IsNavigation4FrontEnd = table.Column<bool>(type: "bit", nullable: false),
                    IsSpecial = table.Column<bool>(type: "bit", nullable: false),
                    HomeRecommendation = table.Column<bool>(type: "bit", nullable: false),
                    ChannelRecommendation = table.Column<bool>(type: "bit", nullable: false),
                    AutoSynchronous = table.Column<bool>(type: "bit", nullable: false),
                    AutoSynchronousForContent = table.Column<bool>(type: "bit", nullable: false),
                    SourceID = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    BackEndModuleId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    FrontEndPageId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    BackendIcon = table.Column<string>(type: "nvarchar(250)", maxLength: 250, nullable: true),
                    MenuItemGroups = table.Column<string>(type: "nvarchar(250)", maxLength: 250, nullable: true),
                    CustomUrl = table.Column<string>(type: "nvarchar(300)", maxLength: 300, nullable: true),
                    CustomData = table.Column<string>(type: "nvarchar(1000)", maxLength: 1000, nullable: true),
                    BackendMenuType = table.Column<byte>(type: "tinyint", nullable: false),
                    CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    CreatorUserId = table.Column<long>(type: "bigint", nullable: true),
                    LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    LastModifierUserId = table.Column<long>(type: "bigint", nullable: true),
                    IsDeleted = table.Column<bool>(type: "bit", nullable: false),
                    DeleterUserId = table.Column<long>(type: "bigint", nullable: true),
                    DeletionTime = table.Column<DateTime>(type: "datetime2", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_AppMenus", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "AppMessages",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    AuxiliaryId = table.Column<long>(type: "bigint", nullable: false),
                    MenuId = table.Column<long>(type: "bigint", nullable: false),
                    Title = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
                    Subhead = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
                    Name = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
                    NickName = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
                    Sex = table.Column<string>(type: "nvarchar(10)", maxLength: 10, nullable: true),
                    MessageType = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
                    EMail = table.Column<string>(type: "nvarchar(30)", maxLength: 30, nullable: true),
                    Tel = table.Column<string>(type: "nvarchar(20)", maxLength: 20, nullable: true),
                    Phone = table.Column<string>(type: "nvarchar(20)", maxLength: 20, nullable: true),
                    Fax = table.Column<string>(type: "nvarchar(20)", maxLength: 20, nullable: true),
                    CompanyName = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
                    Country = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
                    Province = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
                    City = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
                    Area = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
                    Address = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
                    PostCode = table.Column<string>(type: "nvarchar(20)", maxLength: 20, nullable: true),
                    Intro = table.Column<string>(type: "nvarchar(800)", maxLength: 800, nullable: true),
                    BackIntro = table.Column<string>(type: "nvarchar(800)", maxLength: 800, nullable: true),
                    Hit = table.Column<int>(type: "int", nullable: false),
                    Audit = table.Column<int>(type: "int", nullable: false),
                    Order = table.Column<int>(type: "int", nullable: false),
                    IsActive = table.Column<bool>(type: "bit", nullable: false),
                    IsShow = table.Column<bool>(type: "bit", nullable: false),
                    RelevanceId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    TenantId = table.Column<int>(type: "int", nullable: false),
                    Language = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
                    valiCode = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    CreatorUserId = table.Column<long>(type: "bigint", nullable: true),
                    LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    LastModifierUserId = table.Column<long>(type: "bigint", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_AppMessages", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "AppPeriodicBackgroundJobLogs",
                columns: table => new
                {
                    Id = table.Column<long>(type: "bigint", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    Date = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
                    TaskName = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
                    FinishTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    Count = table.Column<int>(type: "int", nullable: false),
                    CustomData = table.Column<string>(type: "nvarchar(2000)", maxLength: 2000, nullable: true),
                    CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    CreatorUserId = table.Column<long>(type: "bigint", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_AppPeriodicBackgroundJobLogs", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "AppPost",
                columns: table => new
                {
                    Id = table.Column<long>(type: "bigint", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    DisplayName = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
                    ShortName = table.Column<string>(type: "nvarchar(32)", maxLength: 32, nullable: true),
                    Order = table.Column<int>(type: "int", nullable: false),
                    OrganizationId = table.Column<long>(type: "bigint", nullable: false),
                    PostLevel = table.Column<int>(type: "int", nullable: false),
                    DeputyPresiding = table.Column<bool>(type: "bit", nullable: false),
                    TenantId = table.Column<int>(type: "int", nullable: true),
                    IsActive = table.Column<bool>(type: "bit", nullable: false),
                    UnqiueName = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    CreatorUserId = table.Column<long>(type: "bigint", nullable: true),
                    LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    LastModifierUserId = table.Column<long>(type: "bigint", nullable: true),
                    IsDeleted = table.Column<bool>(type: "bit", nullable: false),
                    DeleterUserId = table.Column<long>(type: "bigint", nullable: true),
                    DeletionTime = table.Column<DateTime>(type: "datetime2", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_AppPost", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "AppRouteSettings",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    Url = table.Column<string>(type: "nvarchar(350)", maxLength: 350, nullable: false),
                    UrlToLower = table.Column<string>(type: "nvarchar(350)", maxLength: 350, nullable: false),
                    RelatedId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    RealUrl = table.Column<string>(type: "nvarchar(350)", maxLength: 350, nullable: false),
                    RealUrlToLower = table.Column<string>(type: "nvarchar(350)", maxLength: 350, nullable: false),
                    FrontEndPageId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    Kind = table.Column<long>(type: "bigint", nullable: false),
                    ContentId = table.Column<long>(type: "bigint", nullable: false),
                    relateId = table.Column<long>(type: "bigint", nullable: false),
                    Language = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    TenantId = table.Column<int>(type: "int", nullable: false),
                    CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    CreatorUserId = table.Column<long>(type: "bigint", nullable: true),
                    LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    LastModifierUserId = table.Column<long>(type: "bigint", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_AppRouteSettings", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "AppTaxonomys",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    Title = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
                    Norder = table.Column<int>(type: "int", nullable: false),
                    IsTree = table.Column<bool>(type: "bit", nullable: false),
                    IsActive = table.Column<bool>(type: "bit", nullable: false),
                    CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    CreatorUserId = table.Column<long>(type: "bigint", nullable: true),
                    LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    LastModifierUserId = table.Column<long>(type: "bigint", nullable: true),
                    IsDeleted = table.Column<bool>(type: "bit", nullable: false),
                    DeleterUserId = table.Column<long>(type: "bigint", nullable: true),
                    DeletionTime = table.Column<DateTime>(type: "datetime2", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_AppTaxonomys", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "AppTaxonomysItem",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    ParentId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    DisplayName = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: false),
                    Code = table.Column<string>(type: "nvarchar(95)", maxLength: 95, nullable: false),
                    Value = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
                    Norder = table.Column<int>(type: "int", nullable: false),
                    TypeId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    IsActive = table.Column<bool>(type: "bit", nullable: false),
                    Pic1 = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
                    Pic2 = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
                    AuxiliaryId = table.Column<long>(type: "bigint", nullable: false),
                    LinkUrl = table.Column<string>(type: "nvarchar(350)", maxLength: 350, nullable: true),
                    CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    CreatorUserId = table.Column<long>(type: "bigint", nullable: true),
                    LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    LastModifierUserId = table.Column<long>(type: "bigint", nullable: true),
                    IsDeleted = table.Column<bool>(type: "bit", nullable: false),
                    DeleterUserId = table.Column<long>(type: "bigint", nullable: true),
                    DeletionTime = table.Column<DateTime>(type: "datetime2", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_AppTaxonomysItem", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "AppTaxonomysItemBind",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    ItemId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    TenantId = table.Column<int>(type: "int", nullable: false),
                    CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    CreatorUserId = table.Column<long>(type: "bigint", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_AppTaxonomysItemBind", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "AppTemporaryFile",
                columns: table => new
                {
                    Id = table.Column<long>(type: "bigint", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    FileName = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
                    FileUrl = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
                    Sha1 = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
                    Dimensions = table.Column<string>(type: "nvarchar(32)", maxLength: 32, nullable: true),
                    Size = table.Column<long>(type: "bigint", nullable: false),
                    ExName = table.Column<string>(type: "nvarchar(10)", maxLength: 10, nullable: true),
                    CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    CreatorUserId = table.Column<long>(type: "bigint", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_AppTemporaryFile", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "AppUserPost",
                columns: table => new
                {
                    Id = table.Column<long>(type: "bigint", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    UserId = table.Column<long>(type: "bigint", nullable: false),
                    PostId = table.Column<long>(type: "bigint", nullable: false),
                    TenantId = table.Column<int>(type: "int", nullable: false),
                    CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    CreatorUserId = table.Column<long>(type: "bigint", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_AppUserPost", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "AppVerifyCode",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    TenantId = table.Column<int>(type: "int", nullable: false),
                    AuxiliaryId = table.Column<long>(type: "bigint", nullable: false),
                    IsActive = table.Column<bool>(type: "bit", nullable: false),
                    SendTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    Email = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
                    VCode = table.Column<string>(type: "nvarchar(10)", maxLength: 10, nullable: true),
                    C_Type = table.Column<int>(type: "int", nullable: false),
                    CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    CreatorUserId = table.Column<long>(type: "bigint", nullable: true),
                    LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    LastModifierUserId = table.Column<long>(type: "bigint", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_AppVerifyCode", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "AppVersionInfo",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    Name = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
                    ContentId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    Description = table.Column<string>(type: "nvarchar(300)", maxLength: 300, nullable: true),
                    TableName = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
                    CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    CreatorUserId = table.Column<long>(type: "bigint", nullable: true),
                    LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    LastModifierUserId = table.Column<long>(type: "bigint", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_AppVersionInfo", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "AppWorkFlow",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    TenantId = table.Column<int>(type: "int", nullable: false),
                    IsActive = table.Column<bool>(type: "bit", nullable: false),
                    Order = table.Column<int>(type: "int", nullable: false),
                    Name = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: false),
                    ShortName = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
                    CategeoryId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    IsHaveAttachment = table.Column<bool>(type: "bit", nullable: false),
                    IsHaveOnlineWord = table.Column<bool>(type: "bit", nullable: false),
                    EntrustType = table.Column<int>(type: "int", nullable: false),
                    Description = table.Column<string>(type: "nvarchar(512)", maxLength: 512, nullable: true),
                    NumberFormat = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    DigitNumber = table.Column<int>(type: "int", nullable: false),
                    NumberCounting = table.Column<int>(type: "int", nullable: false),
                    UnitIdList = table.Column<string>(type: "nvarchar(2000)", maxLength: 2000, nullable: true),
                    ShouldLogWhenDrawback = table.Column<bool>(type: "bit", nullable: false),
                    OptionFunction = table.Column<string>(type: "nvarchar(300)", maxLength: 300, nullable: true),
                    CustomData = table.Column<string>(type: "nvarchar(3000)", maxLength: 3000, nullable: true),
                    CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    CreatorUserId = table.Column<long>(type: "bigint", nullable: true),
                    LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    LastModifierUserId = table.Column<long>(type: "bigint", nullable: true),
                    IsDeleted = table.Column<bool>(type: "bit", nullable: false),
                    DeleterUserId = table.Column<long>(type: "bigint", nullable: true),
                    DeletionTime = table.Column<DateTime>(type: "datetime2", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_AppWorkFlow", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "AppWorkFlowCategeory",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    TenantId = table.Column<int>(type: "int", nullable: false),
                    Name = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: false),
                    IsActive = table.Column<bool>(type: "bit", nullable: false),
                    Order = table.Column<int>(type: "int", nullable: false),
                    CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    CreatorUserId = table.Column<long>(type: "bigint", nullable: true),
                    LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    LastModifierUserId = table.Column<long>(type: "bigint", nullable: true),
                    IsDeleted = table.Column<bool>(type: "bit", nullable: false),
                    DeleterUserId = table.Column<long>(type: "bigint", nullable: true),
                    DeletionTime = table.Column<DateTime>(type: "datetime2", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_AppWorkFlowCategeory", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "AppWorkFlowForm",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    TenantId = table.Column<int>(type: "int", nullable: false),
                    WorkFlowId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    HtmlData = table.Column<string>(type: "nvarchar(max)", maxLength: 61440, nullable: true),
                    ExtensionData = table.Column<string>(type: "nvarchar(max)", maxLength: 61440, nullable: true),
                    IsActive = table.Column<bool>(type: "bit", nullable: false),
                    CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    CreatorUserId = table.Column<long>(type: "bigint", nullable: true),
                    LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    LastModifierUserId = table.Column<long>(type: "bigint", nullable: true),
                    IsDeleted = table.Column<bool>(type: "bit", nullable: false),
                    DeleterUserId = table.Column<long>(type: "bigint", nullable: true),
                    DeletionTime = table.Column<DateTime>(type: "datetime2", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_AppWorkFlowForm", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "AppWorkFlowLogs",
                columns: table => new
                {
                    Id = table.Column<long>(type: "bigint", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    PaperId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    ProcessId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    FromOperator = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
                    NextOperator = table.Column<string>(type: "nvarchar(1500)", maxLength: 1500, nullable: true),
                    Message = table.Column<string>(type: "nvarchar(512)", maxLength: 512, nullable: true),
                    Parallel = table.Column<bool>(type: "bit", nullable: false),
                    CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    CreatorUserId = table.Column<long>(type: "bigint", nullable: true),
                    LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    LastModifierUserId = table.Column<long>(type: "bigint", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_AppWorkFlowLogs", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "AppWorkFlowNode",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    TenantId = table.Column<int>(type: "int", nullable: false),
                    WorkflowId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    IsActive = table.Column<bool>(type: "bit", nullable: false),
                    Order = table.Column<int>(type: "int", nullable: false),
                    Name = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: false),
                    ShortName = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
                    Description = table.Column<string>(type: "nvarchar(512)", maxLength: 512, nullable: true),
                    ActionScheme = table.Column<int>(type: "int", nullable: false),
                    NextNodeList = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: true),
                    BackNodeList = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: true),
                    UserIdList = table.Column<string>(type: "nvarchar(max)", maxLength: 5000, nullable: true),
                    ActionList = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: true),
                    CanEditAttachment = table.Column<bool>(type: "bit", nullable: false),
                    BeforeSelectFilter = table.Column<int>(type: "int", nullable: false),
                    BeforeSelectMoreFilter = table.Column<string>(type: "nvarchar(2000)", maxLength: 2000, nullable: true),
                    SelectedFilter = table.Column<int>(type: "int", nullable: false),
                    SelectedMoreFilter = table.Column<string>(type: "nvarchar(2000)", maxLength: 2000, nullable: true),
                    HandlingTimeLimit = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: true),
                    IsAutoSendToNext = table.Column<bool>(type: "bit", nullable: false),
                    OptionFunction = table.Column<string>(type: "nvarchar(300)", maxLength: 300, nullable: true),
                    CustomData = table.Column<string>(type: "nvarchar(3000)", maxLength: 3000, nullable: true),
                    CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    CreatorUserId = table.Column<long>(type: "bigint", nullable: true),
                    LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    LastModifierUserId = table.Column<long>(type: "bigint", nullable: true),
                    IsDeleted = table.Column<bool>(type: "bit", nullable: false),
                    DeleterUserId = table.Column<long>(type: "bigint", nullable: true),
                    DeletionTime = table.Column<DateTime>(type: "datetime2", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_AppWorkFlowNode", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "AppWorkFlowPaper",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    WorkFlowId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    NodeId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    PaperState = table.Column<int>(type: "int", nullable: false),
                    Title = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: true),
                    UnitName = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
                    UnitId = table.Column<long>(type: "bigint", nullable: false),
                    CoOperativeUnitIds = table.Column<string>(type: "nvarchar(1000)", maxLength: 1000, nullable: true),
                    MainOperativeUserId = table.Column<string>(type: "nvarchar(1000)", maxLength: 1000, nullable: true),
                    CoOperativeUserIds = table.Column<string>(type: "nvarchar(1000)", maxLength: 1000, nullable: true),
                    CoOperativeUserIdsCopy = table.Column<string>(type: "nvarchar(1000)", maxLength: 1000, nullable: true),
                    UserName = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
                    SerialNumber = table.Column<long>(type: "bigint", nullable: false),
                    Signer = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
                    ReferNumber = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
                    PrintCount = table.Column<int>(type: "int", nullable: false),
                    ApprovalResult = table.Column<int>(type: "int", nullable: false),
                    ProgressState = table.Column<int>(type: "int", nullable: false),
                    HasFinished = table.Column<bool>(type: "bit", nullable: false),
                    DeadLineTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    RegistrationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    WhYear = table.Column<int>(type: "int", nullable: false),
                    WhNumber = table.Column<int>(type: "int", nullable: false),
                    WhName = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
                    WenHaoId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    CreatorUserId = table.Column<long>(type: "bigint", nullable: true),
                    LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    LastModifierUserId = table.Column<long>(type: "bigint", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_AppWorkFlowPaper", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "AppWorkFlowPaperArchive",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    WorkFlowId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    NodeId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    PaperState = table.Column<int>(type: "int", nullable: false),
                    Title = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: true),
                    UnitName = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
                    UnitId = table.Column<long>(type: "bigint", nullable: false),
                    MainOperativeUserId = table.Column<string>(type: "nvarchar(1000)", maxLength: 1000, nullable: true),
                    CoOperativeUserIds = table.Column<string>(type: "nvarchar(1000)", maxLength: 1000, nullable: true),
                    CoOperativeUserIdsCopy = table.Column<string>(type: "nvarchar(1000)", maxLength: 1000, nullable: true),
                    CoOperativeUnitIds = table.Column<string>(type: "nvarchar(1000)", maxLength: 1000, nullable: true),
                    UserName = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
                    SerialNumber = table.Column<long>(type: "bigint", nullable: false),
                    Signer = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
                    ReferNumber = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
                    PrintCount = table.Column<int>(type: "int", nullable: false),
                    ProgressState = table.Column<int>(type: "int", nullable: false),
                    ApprovalResult = table.Column<int>(type: "int", nullable: false),
                    DeadLineTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    RegistrationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    ArchivedTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    ArchivedOperator = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
                    HasFinished = table.Column<bool>(type: "bit", nullable: false),
                    WhYear = table.Column<int>(type: "int", nullable: false),
                    WhNumber = table.Column<int>(type: "int", nullable: false),
                    WhName = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
                    WenHaoId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    Fetched = table.Column<bool>(type: "bit", nullable: false),
                    FetchedTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    CreatorUserId = table.Column<long>(type: "bigint", nullable: true),
                    LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    LastModifierUserId = table.Column<long>(type: "bigint", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_AppWorkFlowPaperArchive", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "AppWorkFlowPaperData",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    PaperId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    Value = table.Column<string>(type: "nvarchar(3072)", maxLength: 3072, nullable: true),
                    FieldName = table.Column<string>(type: "nvarchar(32)", maxLength: 32, nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_AppWorkFlowPaperData", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "AppWorkFlowPaperListCtrl",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    Name = table.Column<string>(type: "nvarchar(32)", maxLength: 32, nullable: false),
                    Description = table.Column<string>(type: "nvarchar(250)", maxLength: 250, nullable: true),
                    ExtensionData = table.Column<string>(type: "nvarchar(max)", maxLength: 61440, nullable: true),
                    IsActive = table.Column<bool>(type: "bit", nullable: false),
                    TenantId = table.Column<int>(type: "int", nullable: false),
                    CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    CreatorUserId = table.Column<long>(type: "bigint", nullable: true),
                    LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    LastModifierUserId = table.Column<long>(type: "bigint", nullable: true),
                    IsDeleted = table.Column<bool>(type: "bit", nullable: false),
                    DeleterUserId = table.Column<long>(type: "bigint", nullable: true),
                    DeletionTime = table.Column<DateTime>(type: "datetime2", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_AppWorkFlowPaperListCtrl", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "AppWorkFlowPaperListCtrlData",
                columns: table => new
                {
                    Id = table.Column<long>(type: "bigint", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    Data1 = table.Column<string>(type: "nvarchar(512)", maxLength: 512, nullable: true),
                    Data2 = table.Column<string>(type: "nvarchar(512)", maxLength: 512, nullable: true),
                    Data3 = table.Column<string>(type: "nvarchar(512)", maxLength: 512, nullable: true),
                    Data4 = table.Column<string>(type: "nvarchar(512)", maxLength: 512, nullable: true),
                    Data5 = table.Column<string>(type: "nvarchar(512)", maxLength: 512, nullable: true),
                    Data6 = table.Column<string>(type: "nvarchar(512)", maxLength: 512, nullable: true),
                    Data7 = table.Column<string>(type: "nvarchar(512)", maxLength: 512, nullable: true),
                    Data8 = table.Column<string>(type: "nvarchar(512)", maxLength: 512, nullable: true),
                    Data9 = table.Column<string>(type: "nvarchar(512)", maxLength: 512, nullable: true),
                    Data10 = table.Column<string>(type: "nvarchar(512)", maxLength: 512, nullable: true),
                    Data11 = table.Column<string>(type: "nvarchar(512)", maxLength: 512, nullable: true),
                    Data12 = table.Column<string>(type: "nvarchar(512)", maxLength: 512, nullable: true),
                    Data13 = table.Column<string>(type: "nvarchar(512)", maxLength: 512, nullable: true),
                    Data14 = table.Column<string>(type: "nvarchar(512)", maxLength: 512, nullable: true),
                    Data15 = table.Column<string>(type: "nvarchar(512)", maxLength: 512, nullable: true),
                    Order = table.Column<int>(type: "int", nullable: false),
                    RelateId = table.Column<Guid>(type: "uniqueidentifier", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_AppWorkFlowPaperListCtrlData", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "AppWorkFlowProcess",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    WorkFlowId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    NodeId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    UserId = table.Column<long>(type: "bigint", nullable: false),
                    UserName = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
                    UserInfoDtoJson = table.Column<string>(type: "nvarchar(2000)", maxLength: 2000, nullable: true),
                    PaperId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    State = table.Column<int>(type: "int", nullable: false),
                    HasMarked = table.Column<bool>(type: "bit", nullable: false),
                    MarkedTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    Reply = table.Column<string>(type: "nvarchar(2000)", maxLength: 2000, nullable: true),
                    ReplyTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    FinishedTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    TrunkId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    PreStepId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    PreOperatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    ActionScheme = table.Column<int>(type: "int", nullable: false),
                    StartTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    IsDefaultMsg = table.Column<bool>(type: "bit", nullable: false),
                    Code = table.Column<string>(type: "nvarchar(300)", maxLength: 300, nullable: true),
                    StepCode = table.Column<int>(type: "int", nullable: false),
                    MovePattern = table.Column<int>(type: "int", nullable: false),
                    OperationType = table.Column<int>(type: "int", nullable: false),
                    HasRead = table.Column<bool>(type: "bit", nullable: false),
                    WaitingList = table.Column<string>(type: "nvarchar(2000)", maxLength: 2000, nullable: true),
                    ResponsibilityId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    FinishedByTheWay = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    Parallel = table.Column<bool>(type: "bit", nullable: false),
                    EndNodeId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    Signal = table.Column<string>(type: "nvarchar(300)", maxLength: 300, nullable: true),
                    Signal2 = table.Column<string>(type: "nvarchar(300)", maxLength: 300, nullable: true),
                    CustomData = table.Column<string>(type: "nvarchar(2048)", maxLength: 2048, nullable: true),
                    IsHiddenInTable = table.Column<bool>(type: "bit", nullable: false),
                    Severity = table.Column<int>(type: "int", nullable: false),
                    FormDataCache = table.Column<string>(type: "nvarchar(max)", maxLength: 4096, nullable: true),
                    CanEditForm = table.Column<bool>(type: "bit", nullable: false),
                    CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    CreatorUserId = table.Column<long>(type: "bigint", nullable: true),
                    LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    LastModifierUserId = table.Column<long>(type: "bigint", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_AppWorkFlowProcess", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "AppWorkFlowProcessMsg",
                columns: table => new
                {
                    Id = table.Column<long>(type: "bigint", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    PaperId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    TaskId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    Reply = table.Column<string>(type: "nvarchar(2000)", maxLength: 2000, nullable: true),
                    ReplyTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    UserName = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
                    IsHiddenInTable = table.Column<bool>(type: "bit", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_AppWorkFlowProcessMsg", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "AppWorkFlowRelationship",
                columns: table => new
                {
                    Id = table.Column<long>(type: "bigint", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    PaperId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    ResponsibilityId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    TaskId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    IsCanceled = table.Column<bool>(type: "bit", nullable: false),
                    StateModifierTaskId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    HasMarked = table.Column<bool>(type: "bit", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_AppWorkFlowRelationship", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "AppWorkFlowRunTime",
                columns: table => new
                {
                    Id = table.Column<long>(type: "bigint", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    PaperId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    ProcessId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    State = table.Column<int>(type: "int", nullable: false),
                    UserId = table.Column<long>(type: "bigint", nullable: false),
                    StartTime = table.Column<DateTime>(type: "datetime2", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_AppWorkFlowRunTime", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "MtAuditLogs",
                columns: table => new
                {
                    Id = table.Column<long>(type: "bigint", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    TenantId = table.Column<int>(type: "int", nullable: true),
                    UserId = table.Column<long>(type: "bigint", nullable: true),
                    ServiceName = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
                    MethodName = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
                    Parameters = table.Column<string>(type: "nvarchar(max)", maxLength: 1048576, nullable: true),
                    ReturnValue = table.Column<string>(type: "nvarchar(1024)", maxLength: 1024, nullable: true),
                    ExecutionTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    ExecutionDuration = table.Column<int>(type: "int", nullable: false),
                    ClientIpAddress = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
                    ClientName = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: true),
                    BrowserInfo = table.Column<string>(type: "nvarchar(512)", maxLength: 512, nullable: true),
                    ExceptionMessage = table.Column<string>(type: "nvarchar(1024)", maxLength: 1024, nullable: true),
                    Exception = table.Column<string>(type: "nvarchar(2000)", maxLength: 2000, nullable: true),
                    ImpersonatorUserId = table.Column<long>(type: "bigint", nullable: true),
                    ImpersonatorTenantId = table.Column<int>(type: "int", nullable: true),
                    CustomData = table.Column<string>(type: "nvarchar(2000)", maxLength: 2000, nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_MtAuditLogs", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "MtBackgroundJobs",
                columns: table => new
                {
                    Id = table.Column<long>(type: "bigint", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    JobType = table.Column<string>(type: "nvarchar(512)", maxLength: 512, nullable: false),
                    JobArgs = table.Column<string>(type: "nvarchar(max)", maxLength: 1048576, nullable: false),
                    TryCount = table.Column<short>(type: "smallint", nullable: false),
                    NextTryTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    LastTryTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    IsAbandoned = table.Column<bool>(type: "bit", nullable: false),
                    Priority = table.Column<byte>(type: "tinyint", nullable: false),
                    CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    CreatorUserId = table.Column<long>(type: "bigint", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_MtBackgroundJobs", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "MtCacheBackUp",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    Data = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    DataType = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
                    CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    CacheExpireTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    DataId = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_MtCacheBackUp", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "MtChatMessages",
                columns: table => new
                {
                    Id = table.Column<long>(type: "bigint", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    UserId = table.Column<long>(type: "bigint", nullable: false),
                    TenantId = table.Column<int>(type: "int", nullable: true),
                    TargetUserId = table.Column<long>(type: "bigint", nullable: false),
                    TargetTenantId = table.Column<int>(type: "int", nullable: true),
                    Message = table.Column<string>(type: "nvarchar(max)", maxLength: 4096, nullable: false),
                    CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    Side = table.Column<int>(type: "int", nullable: false),
                    ReadState = table.Column<int>(type: "int", nullable: false),
                    ReceiverReadState = table.Column<int>(type: "int", nullable: false),
                    SharedMessageId = table.Column<Guid>(type: "uniqueidentifier", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_MtChatMessages", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "MtCustomConfigurations",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    Name = table.Column<string>(type: "nvarchar(32)", maxLength: 32, nullable: false),
                    Key = table.Column<string>(type: "nvarchar(32)", maxLength: 32, nullable: false),
                    Description = table.Column<string>(type: "nvarchar(250)", maxLength: 250, nullable: true),
                    ExtensionData = table.Column<string>(type: "nvarchar(max)", maxLength: 20480, nullable: true),
                    DataType = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: true),
                    IsActive = table.Column<bool>(type: "bit", nullable: false),
                    CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    CreatorUserId = table.Column<long>(type: "bigint", nullable: true),
                    LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    LastModifierUserId = table.Column<long>(type: "bigint", nullable: true),
                    IsDeleted = table.Column<bool>(type: "bit", nullable: false),
                    DeleterUserId = table.Column<long>(type: "bigint", nullable: true),
                    DeletionTime = table.Column<DateTime>(type: "datetime2", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_MtCustomConfigurations", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "MtDynamicProperties",
                columns: table => new
                {
                    Id = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    PropertyName = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
                    DisplayName = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    InputType = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Permission = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    TenantId = table.Column<int>(type: "int", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_MtDynamicProperties", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "MtEditions",
                columns: table => new
                {
                    Id = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    Name = table.Column<string>(type: "nvarchar(32)", maxLength: 32, nullable: false),
                    DisplayName = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
                    CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    CreatorUserId = table.Column<long>(type: "bigint", nullable: true),
                    LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    LastModifierUserId = table.Column<long>(type: "bigint", nullable: true),
                    IsDeleted = table.Column<bool>(type: "bit", nullable: false),
                    DeleterUserId = table.Column<long>(type: "bigint", nullable: true),
                    DeletionTime = table.Column<DateTime>(type: "datetime2", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_MtEditions", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "MtEntityChangeSets",
                columns: table => new
                {
                    Id = table.Column<long>(type: "bigint", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    BrowserInfo = table.Column<string>(type: "nvarchar(512)", maxLength: 512, nullable: true),
                    ClientIpAddress = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
                    ClientName = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: true),
                    CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    ExtensionData = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    ImpersonatorTenantId = table.Column<int>(type: "int", nullable: true),
                    ImpersonatorUserId = table.Column<long>(type: "bigint", nullable: true),
                    Reason = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
                    TenantId = table.Column<int>(type: "int", nullable: true),
                    UserId = table.Column<long>(type: "bigint", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_MtEntityChangeSets", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "MtFriendships",
                columns: table => new
                {
                    Id = table.Column<long>(type: "bigint", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    UserId = table.Column<long>(type: "bigint", nullable: false),
                    TenantId = table.Column<int>(type: "int", nullable: true),
                    FriendUserId = table.Column<long>(type: "bigint", nullable: false),
                    FriendTenantId = table.Column<int>(type: "int", nullable: true),
                    FriendUserName = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: false),
                    FriendTenancyName = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    FriendProfilePictureId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    State = table.Column<int>(type: "int", nullable: false),
                    CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_MtFriendships", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "MtLanguages",
                columns: table => new
                {
                    Id = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    TenantId = table.Column<int>(type: "int", nullable: true),
                    Name = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: false),
                    DisplayName = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
                    Icon = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: true),
                    IsDisabled = table.Column<bool>(type: "bit", nullable: false),
                    Discriminator = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
                    SourceLanguageId = table.Column<int>(type: "int", nullable: true),
                    CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    CreatorUserId = table.Column<long>(type: "bigint", nullable: true),
                    LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    LastModifierUserId = table.Column<long>(type: "bigint", nullable: true),
                    IsDeleted = table.Column<bool>(type: "bit", nullable: false),
                    DeleterUserId = table.Column<long>(type: "bigint", nullable: true),
                    DeletionTime = table.Column<DateTime>(type: "datetime2", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_MtLanguages", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "MtLanguageTexts",
                columns: table => new
                {
                    Id = table.Column<long>(type: "bigint", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    TenantId = table.Column<int>(type: "int", nullable: true),
                    LanguageName = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: false),
                    Source = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: false),
                    Key = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: false),
                    Value = table.Column<string>(type: "nvarchar(max)", maxLength: 67108864, nullable: false),
                    CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    CreatorUserId = table.Column<long>(type: "bigint", nullable: true),
                    LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    LastModifierUserId = table.Column<long>(type: "bigint", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_MtLanguageTexts", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "MtNotifications",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    NotificationName = table.Column<string>(type: "nvarchar(96)", maxLength: 96, nullable: false),
                    Data = table.Column<string>(type: "nvarchar(max)", maxLength: 1048576, nullable: true),
                    DataTypeName = table.Column<string>(type: "nvarchar(512)", maxLength: 512, nullable: true),
                    EntityTypeName = table.Column<string>(type: "nvarchar(250)", maxLength: 250, nullable: true),
                    EntityTypeAssemblyQualifiedName = table.Column<string>(type: "nvarchar(512)", maxLength: 512, nullable: true),
                    EntityId = table.Column<string>(type: "nvarchar(96)", maxLength: 96, nullable: true),
                    Severity = table.Column<byte>(type: "tinyint", nullable: false),
                    UserIds = table.Column<string>(type: "nvarchar(max)", maxLength: 131072, nullable: true),
                    ExcludedUserIds = table.Column<string>(type: "nvarchar(max)", maxLength: 131072, nullable: true),
                    TenantIds = table.Column<string>(type: "nvarchar(max)", maxLength: 131072, nullable: true),
                    CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    CreatorUserId = table.Column<long>(type: "bigint", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_MtNotifications", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "MtNotificationSubscriptions",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    TenantId = table.Column<int>(type: "int", nullable: true),
                    UserId = table.Column<long>(type: "bigint", nullable: false),
                    NotificationName = table.Column<string>(type: "nvarchar(96)", maxLength: 96, nullable: true),
                    EntityTypeName = table.Column<string>(type: "nvarchar(250)", maxLength: 250, nullable: true),
                    EntityTypeAssemblyQualifiedName = table.Column<string>(type: "nvarchar(512)", maxLength: 512, nullable: true),
                    EntityId = table.Column<string>(type: "nvarchar(96)", maxLength: 96, nullable: true),
                    CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    CreatorUserId = table.Column<long>(type: "bigint", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_MtNotificationSubscriptions", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "MtOrganizationUnitRoles",
                columns: table => new
                {
                    Id = table.Column<long>(type: "bigint", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    TenantId = table.Column<int>(type: "int", nullable: true),
                    RoleId = table.Column<int>(type: "int", nullable: false),
                    OrganizationUnitId = table.Column<long>(type: "bigint", nullable: false),
                    IsDeleted = table.Column<bool>(type: "bit", nullable: false),
                    CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    CreatorUserId = table.Column<long>(type: "bigint", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_MtOrganizationUnitRoles", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "MtOrganizationUnits",
                columns: table => new
                {
                    Id = table.Column<long>(type: "bigint", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    TenantId = table.Column<int>(type: "int", nullable: true),
                    ParentId = table.Column<long>(type: "bigint", nullable: true),
                    Code = table.Column<string>(type: "nvarchar(95)", maxLength: 95, nullable: false),
                    DisplayName = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: false),
                    Discriminator = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
                    ShortName = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
                    IsActive = table.Column<bool>(type: "bit", nullable: true),
                    CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    CreatorUserId = table.Column<long>(type: "bigint", nullable: true),
                    LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    LastModifierUserId = table.Column<long>(type: "bigint", nullable: true),
                    IsDeleted = table.Column<bool>(type: "bit", nullable: false),
                    DeleterUserId = table.Column<long>(type: "bigint", nullable: true),
                    DeletionTime = table.Column<DateTime>(type: "datetime2", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_MtOrganizationUnits", x => x.Id);
                    table.ForeignKey(
                        name: "FK_MtOrganizationUnits_MtOrganizationUnits_ParentId",
                        column: x => x.ParentId,
                        principalTable: "MtOrganizationUnits",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Restrict);
                });

            migrationBuilder.CreateTable(
                name: "MtSeos",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    TenantId = table.Column<int>(type: "int", nullable: false),
                    Language = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
                    RelatedId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    Title = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: true),
                    Description = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: true),
                    KeyWords = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: true),
                    CustomData = table.Column<string>(type: "nvarchar(2048)", maxLength: 2048, nullable: true),
                    CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    CreatorUserId = table.Column<long>(type: "bigint", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_MtSeos", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "MtShortIds",
                columns: table => new
                {
                    Id = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    AuxiliaryId = table.Column<long>(type: "bigint", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_MtShortIds", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "MtStaticPages",
                columns: table => new
                {
                    Id = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    RealUrl = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: true),
                    VisitUrl = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: true),
                    Authority = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
                    DeviceType = table.Column<byte>(type: "tinyint", nullable: false),
                    Path = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: true),
                    State = table.Column<int>(type: "int", nullable: false),
                    RefreshTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    ReTryTime = table.Column<int>(type: "int", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_MtStaticPages", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "MtTenantNotifications",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    TenantId = table.Column<int>(type: "int", nullable: true),
                    NotificationName = table.Column<string>(type: "nvarchar(96)", maxLength: 96, nullable: false),
                    Data = table.Column<string>(type: "nvarchar(max)", maxLength: 1048576, nullable: true),
                    DataTypeName = table.Column<string>(type: "nvarchar(512)", maxLength: 512, nullable: true),
                    EntityTypeName = table.Column<string>(type: "nvarchar(250)", maxLength: 250, nullable: true),
                    EntityTypeAssemblyQualifiedName = table.Column<string>(type: "nvarchar(512)", maxLength: 512, nullable: true),
                    EntityId = table.Column<string>(type: "nvarchar(96)", maxLength: 96, nullable: true),
                    Severity = table.Column<byte>(type: "tinyint", nullable: false),
                    CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    CreatorUserId = table.Column<long>(type: "bigint", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_MtTenantNotifications", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "MtUserAccounts",
                columns: table => new
                {
                    Id = table.Column<long>(type: "bigint", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    TenantId = table.Column<int>(type: "int", nullable: true),
                    UserId = table.Column<long>(type: "bigint", nullable: false),
                    UserLinkId = table.Column<long>(type: "bigint", nullable: true),
                    UserName = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
                    EmailAddress = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
                    CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    CreatorUserId = table.Column<long>(type: "bigint", nullable: true),
                    LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    LastModifierUserId = table.Column<long>(type: "bigint", nullable: true),
                    IsDeleted = table.Column<bool>(type: "bit", nullable: false),
                    DeleterUserId = table.Column<long>(type: "bigint", nullable: true),
                    DeletionTime = table.Column<DateTime>(type: "datetime2", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_MtUserAccounts", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "MtUserDelegations",
                columns: table => new
                {
                    Id = table.Column<long>(type: "bigint", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    SourceUserId = table.Column<long>(type: "bigint", nullable: false),
                    TargetUserId = table.Column<long>(type: "bigint", nullable: false),
                    TenantId = table.Column<int>(type: "int", nullable: true),
                    StartTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    EndTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    CreatorUserId = table.Column<long>(type: "bigint", nullable: true),
                    LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    LastModifierUserId = table.Column<long>(type: "bigint", nullable: true),
                    IsDeleted = table.Column<bool>(type: "bit", nullable: false),
                    DeleterUserId = table.Column<long>(type: "bigint", nullable: true),
                    DeletionTime = table.Column<DateTime>(type: "datetime2", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_MtUserDelegations", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "MtUserExtension",
                columns: table => new
                {
                    Id = table.Column<long>(type: "bigint", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    UserId = table.Column<long>(type: "bigint", nullable: false),
                    MainUnitId = table.Column<long>(type: "bigint", nullable: false),
                    CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    CreatorUserId = table.Column<long>(type: "bigint", nullable: true),
                    LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    LastModifierUserId = table.Column<long>(type: "bigint", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_MtUserExtension", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "MtUserLoginAttempts",
                columns: table => new
                {
                    Id = table.Column<long>(type: "bigint", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    TenantId = table.Column<int>(type: "int", nullable: true),
                    TenancyName = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
                    UserId = table.Column<long>(type: "bigint", nullable: true),
                    UserNameOrEmailAddress = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
                    ClientIpAddress = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
                    ClientName = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: true),
                    BrowserInfo = table.Column<string>(type: "nvarchar(512)", maxLength: 512, nullable: true),
                    Result = table.Column<byte>(type: "tinyint", nullable: false),
                    CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_MtUserLoginAttempts", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "MtUserNotifications",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    TenantId = table.Column<int>(type: "int", nullable: true),
                    UserId = table.Column<long>(type: "bigint", nullable: false),
                    TenantNotificationId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    State = table.Column<int>(type: "int", nullable: false),
                    CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    Discriminator = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
                    ReadTime = table.Column<DateTime>(type: "datetime2", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_MtUserNotifications", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "MtUsers",
                columns: table => new
                {
                    Id = table.Column<long>(type: "bigint", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    AdministratorWeight = table.Column<int>(type: "int", nullable: false),
                    Order = table.Column<int>(type: "int", nullable: false),
                    CultureName = table.Column<string>(type: "nvarchar(30)", maxLength: 30, nullable: true),
                    LastPwdChangeTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    ProfilePictureId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    ShouldChangePasswordOnNextLogin = table.Column<bool>(type: "bit", nullable: false),
                    SignInTokenExpireTimeUtc = table.Column<DateTime>(type: "datetime2", nullable: true),
                    SignInToken = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    GoogleAuthenticatorKey = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    CreatorUserId = table.Column<long>(type: "bigint", nullable: true),
                    LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    LastModifierUserId = table.Column<long>(type: "bigint", nullable: true),
                    IsDeleted = table.Column<bool>(type: "bit", nullable: false),
                    DeleterUserId = table.Column<long>(type: "bigint", nullable: true),
                    DeletionTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    AuthenticationSource = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
                    UserName = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: false),
                    TenantId = table.Column<int>(type: "int", nullable: true),
                    EmailAddress = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: false),
                    Name = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
                    Surname = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
                    Password = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: false),
                    EmailConfirmationCode = table.Column<string>(type: "nvarchar(328)", maxLength: 328, nullable: true),
                    PasswordResetCode = table.Column<string>(type: "nvarchar(328)", maxLength: 328, nullable: true),
                    LockoutEndDateUtc = table.Column<DateTime>(type: "datetime2", nullable: true),
                    AccessFailedCount = table.Column<int>(type: "int", nullable: false),
                    IsLockoutEnabled = table.Column<bool>(type: "bit", nullable: false),
                    PhoneNumber = table.Column<string>(type: "nvarchar(32)", maxLength: 32, nullable: true),
                    IsPhoneNumberConfirmed = table.Column<bool>(type: "bit", nullable: false),
                    SecurityStamp = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: true),
                    IsTwoFactorEnabled = table.Column<bool>(type: "bit", nullable: false),
                    IsEmailConfirmed = table.Column<bool>(type: "bit", nullable: false),
                    IsActive = table.Column<bool>(type: "bit", nullable: false),
                    NormalizedUserName = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: false),
                    NormalizedEmailAddress = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: false),
                    ConcurrencyStamp = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_MtUsers", x => x.Id);
                    table.ForeignKey(
                        name: "FK_MtUsers_MtUsers_CreatorUserId",
                        column: x => x.CreatorUserId,
                        principalTable: "MtUsers",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_MtUsers_MtUsers_DeleterUserId",
                        column: x => x.DeleterUserId,
                        principalTable: "MtUsers",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_MtUsers_MtUsers_LastModifierUserId",
                        column: x => x.LastModifierUserId,
                        principalTable: "MtUsers",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Restrict);
                });

            migrationBuilder.CreateTable(
                name: "MtWebhookEvents",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    WebhookName = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    Data = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    TenantId = table.Column<int>(type: "int", nullable: true),
                    IsDeleted = table.Column<bool>(type: "bit", nullable: false),
                    DeletionTime = table.Column<DateTime>(type: "datetime2", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_MtWebhookEvents", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "MtWebhookSubscriptions",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    TenantId = table.Column<int>(type: "int", nullable: true),
                    WebhookUri = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    Secret = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    IsActive = table.Column<bool>(type: "bit", nullable: false),
                    Webhooks = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Headers = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    CreatorUserId = table.Column<long>(type: "bigint", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_MtWebhookSubscriptions", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "AppPageViews",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    Name = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
                    IsActive = table.Column<bool>(type: "bit", nullable: false),
                    PageSize = table.Column<int>(type: "int", nullable: false),
                    BodyView = table.Column<string>(type: "nvarchar(250)", maxLength: 250, nullable: false),
                    PcOrMobile = table.Column<byte>(type: "tinyint", nullable: false),
                    FrontEndPageId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    CreatorUserId = table.Column<long>(type: "bigint", nullable: true),
                    LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    LastModifierUserId = table.Column<long>(type: "bigint", nullable: true),
                    IsDeleted = table.Column<bool>(type: "bit", nullable: false),
                    DeleterUserId = table.Column<long>(type: "bigint", nullable: true),
                    DeletionTime = table.Column<DateTime>(type: "datetime2", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_AppPageViews", x => x.Id);
                    table.ForeignKey(
                        name: "FK_AppPageViews_AppFrontEndPages_FrontEndPageId",
                        column: x => x.FrontEndPageId,
                        principalTable: "AppFrontEndPages",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateTable(
                name: "AppBundlings",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    TenantId = table.Column<int>(type: "int", nullable: false),
                    MenuId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    MenuFid = table.Column<long>(type: "bigint", nullable: false),
                    StylePc = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: true),
                    StyleMobile = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: true),
                    StyleRltPc = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: true),
                    StyleRltMobile = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: true),
                    ScriptPc = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: true),
                    ScriptMobile = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: true),
                    ScriptPcBottom = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: true),
                    ScriptMobileBottom = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: true),
                    SourceID = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    AutoSynchronous = table.Column<bool>(type: "bit", nullable: false),
                    CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    CreatorUserId = table.Column<long>(type: "bigint", nullable: true),
                    LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    LastModifierUserId = table.Column<long>(type: "bigint", nullable: true),
                    IsDeleted = table.Column<bool>(type: "bit", nullable: false),
                    DeleterUserId = table.Column<long>(type: "bigint", nullable: true),
                    DeletionTime = table.Column<DateTime>(type: "datetime2", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_AppBundlings", x => x.Id);
                    table.ForeignKey(
                        name: "FK_AppBundlings_AppMenus_MenuId",
                        column: x => x.MenuId,
                        principalTable: "AppMenus",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateTable(
                name: "AppChannelObjects",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    TenantId = table.Column<int>(type: "int", nullable: false),
                    MenuId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    Key = table.Column<string>(type: "nvarchar(80)", maxLength: 80, nullable: true),
                    Key2 = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
                    Picurl = table.Column<string>(type: "nvarchar(250)", maxLength: 250, nullable: true),
                    PicurlOnHover = table.Column<string>(type: "nvarchar(250)", maxLength: 250, nullable: true),
                    IconUrl = table.Column<string>(type: "nvarchar(250)", maxLength: 250, nullable: true),
                    Title = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
                    Description = table.Column<string>(type: "nvarchar(max)", maxLength: 20480, nullable: true),
                    Text = table.Column<string>(type: "nvarchar(max)", maxLength: 20480, nullable: true),
                    LinkUrl = table.Column<string>(type: "nvarchar(350)", maxLength: 350, nullable: true),
                    Target = table.Column<string>(type: "nvarchar(20)", maxLength: 20, nullable: true),
                    Order = table.Column<int>(type: "int", nullable: false),
                    IsActive = table.Column<bool>(type: "bit", nullable: false),
                    Language = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
                    SourceID = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    AutoSynchronous = table.Column<bool>(type: "bit", nullable: false),
                    Str1 = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: true),
                    Str2 = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: true),
                    Str3 = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: true),
                    Str4 = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: true),
                    Str5 = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: true),
                    Bool1 = table.Column<bool>(type: "bit", nullable: false),
                    Bool2 = table.Column<bool>(type: "bit", nullable: false),
                    Bool3 = table.Column<bool>(type: "bit", nullable: false),
                    Bool4 = table.Column<bool>(type: "bit", nullable: false),
                    Pic1 = table.Column<string>(type: "nvarchar(250)", maxLength: 250, nullable: true),
                    Pic2 = table.Column<string>(type: "nvarchar(250)", maxLength: 250, nullable: true),
                    Time1 = table.Column<long>(type: "bigint", nullable: false),
                    Time2 = table.Column<long>(type: "bigint", nullable: false),
                    Time3 = table.Column<long>(type: "bigint", nullable: false),
                    Time4 = table.Column<long>(type: "bigint", nullable: false),
                    CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    CreatorUserId = table.Column<long>(type: "bigint", nullable: true),
                    LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    LastModifierUserId = table.Column<long>(type: "bigint", nullable: true),
                    IsDeleted = table.Column<bool>(type: "bit", nullable: false),
                    DeleterUserId = table.Column<long>(type: "bigint", nullable: true),
                    DeletionTime = table.Column<DateTime>(type: "datetime2", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_AppChannelObjects", x => x.Id);
                    table.ForeignKey(
                        name: "FK_AppChannelObjects_AppMenus_MenuId",
                        column: x => x.MenuId,
                        principalTable: "AppMenus",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateTable(
                name: "AppPostOrganization",
                columns: table => new
                {
                    Id = table.Column<long>(type: "bigint", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    PostId = table.Column<long>(type: "bigint", nullable: false),
                    OrganizationId = table.Column<long>(type: "bigint", nullable: false),
                    TenantId = table.Column<int>(type: "int", nullable: false),
                    CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    CreatorUserId = table.Column<long>(type: "bigint", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_AppPostOrganization", x => x.Id);
                    table.ForeignKey(
                        name: "FK_AppPostOrganization_AppPost_PostId",
                        column: x => x.PostId,
                        principalTable: "AppPost",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateTable(
                name: "MtDynamicEntityProperties",
                columns: table => new
                {
                    Id = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    EntityFullName = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
                    DynamicPropertyId = table.Column<int>(type: "int", nullable: false),
                    TenantId = table.Column<int>(type: "int", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_MtDynamicEntityProperties", x => x.Id);
                    table.ForeignKey(
                        name: "FK_MtDynamicEntityProperties_MtDynamicProperties_DynamicPropertyId",
                        column: x => x.DynamicPropertyId,
                        principalTable: "MtDynamicProperties",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateTable(
                name: "MtDynamicPropertyValues",
                columns: table => new
                {
                    Id = table.Column<long>(type: "bigint", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    Value = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    TenantId = table.Column<int>(type: "int", nullable: true),
                    DynamicPropertyId = table.Column<int>(type: "int", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_MtDynamicPropertyValues", x => x.Id);
                    table.ForeignKey(
                        name: "FK_MtDynamicPropertyValues_MtDynamicProperties_DynamicPropertyId",
                        column: x => x.DynamicPropertyId,
                        principalTable: "MtDynamicProperties",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateTable(
                name: "MtFeatures",
                columns: table => new
                {
                    Id = table.Column<long>(type: "bigint", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    TenantId = table.Column<int>(type: "int", nullable: true),
                    Name = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: false),
                    Value = table.Column<string>(type: "nvarchar(2000)", maxLength: 2000, nullable: false),
                    Discriminator = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
                    EditionId = table.Column<int>(type: "int", nullable: true),
                    CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    CreatorUserId = table.Column<long>(type: "bigint", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_MtFeatures", x => x.Id);
                    table.ForeignKey(
                        name: "FK_MtFeatures_MtEditions_EditionId",
                        column: x => x.EditionId,
                        principalTable: "MtEditions",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateTable(
                name: "MtEntityChanges",
                columns: table => new
                {
                    Id = table.Column<long>(type: "bigint", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    ChangeTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    ChangeType = table.Column<byte>(type: "tinyint", nullable: false),
                    EntityChangeSetId = table.Column<long>(type: "bigint", nullable: false),
                    EntityId = table.Column<string>(type: "nvarchar(48)", maxLength: 48, nullable: true),
                    EntityTypeFullName = table.Column<string>(type: "nvarchar(192)", maxLength: 192, nullable: true),
                    TenantId = table.Column<int>(type: "int", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_MtEntityChanges", x => x.Id);
                    table.ForeignKey(
                        name: "FK_MtEntityChanges_MtEntityChangeSets_EntityChangeSetId",
                        column: x => x.EntityChangeSetId,
                        principalTable: "MtEntityChangeSets",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateTable(
                name: "MtRoles",
                columns: table => new
                {
                    Id = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    Order = table.Column<int>(type: "int", nullable: false),
                    CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    CreatorUserId = table.Column<long>(type: "bigint", nullable: true),
                    LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    LastModifierUserId = table.Column<long>(type: "bigint", nullable: true),
                    IsDeleted = table.Column<bool>(type: "bit", nullable: false),
                    DeleterUserId = table.Column<long>(type: "bigint", nullable: true),
                    DeletionTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    TenantId = table.Column<int>(type: "int", nullable: true),
                    Name = table.Column<string>(type: "nvarchar(32)", maxLength: 32, nullable: false),
                    DisplayName = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
                    IsStatic = table.Column<bool>(type: "bit", nullable: false),
                    IsDefault = table.Column<bool>(type: "bit", nullable: false),
                    NormalizedName = table.Column<string>(type: "nvarchar(32)", maxLength: 32, nullable: false),
                    ConcurrencyStamp = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_MtRoles", x => x.Id);
                    table.ForeignKey(
                        name: "FK_MtRoles_MtUsers_CreatorUserId",
                        column: x => x.CreatorUserId,
                        principalTable: "MtUsers",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_MtRoles_MtUsers_DeleterUserId",
                        column: x => x.DeleterUserId,
                        principalTable: "MtUsers",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_MtRoles_MtUsers_LastModifierUserId",
                        column: x => x.LastModifierUserId,
                        principalTable: "MtUsers",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Restrict);
                });

            migrationBuilder.CreateTable(
                name: "MtSettings",
                columns: table => new
                {
                    Id = table.Column<long>(type: "bigint", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    TenantId = table.Column<int>(type: "int", nullable: true),
                    UserId = table.Column<long>(type: "bigint", nullable: true),
                    Name = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: false),
                    Value = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    CreatorUserId = table.Column<long>(type: "bigint", nullable: true),
                    LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    LastModifierUserId = table.Column<long>(type: "bigint", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_MtSettings", x => x.Id);
                    table.ForeignKey(
                        name: "FK_MtSettings_MtUsers_UserId",
                        column: x => x.UserId,
                        principalTable: "MtUsers",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Restrict);
                });

            migrationBuilder.CreateTable(
                name: "MtTenants",
                columns: table => new
                {
                    Id = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    CreatorUserId = table.Column<long>(type: "bigint", nullable: true),
                    LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    LastModifierUserId = table.Column<long>(type: "bigint", nullable: true),
                    IsDeleted = table.Column<bool>(type: "bit", nullable: false),
                    DeleterUserId = table.Column<long>(type: "bigint", nullable: true),
                    DeletionTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    TenancyName = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
                    Name = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: false),
                    ConnectionString = table.Column<string>(type: "nvarchar(1024)", maxLength: 1024, nullable: true),
                    IsActive = table.Column<bool>(type: "bit", nullable: false),
                    EditionId = table.Column<int>(type: "int", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_MtTenants", x => x.Id);
                    table.ForeignKey(
                        name: "FK_MtTenants_MtEditions_EditionId",
                        column: x => x.EditionId,
                        principalTable: "MtEditions",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_MtTenants_MtUsers_CreatorUserId",
                        column: x => x.CreatorUserId,
                        principalTable: "MtUsers",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_MtTenants_MtUsers_DeleterUserId",
                        column: x => x.DeleterUserId,
                        principalTable: "MtUsers",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_MtTenants_MtUsers_LastModifierUserId",
                        column: x => x.LastModifierUserId,
                        principalTable: "MtUsers",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Restrict);
                });

            migrationBuilder.CreateTable(
                name: "MtUserClaims",
                columns: table => new
                {
                    Id = table.Column<long>(type: "bigint", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    TenantId = table.Column<int>(type: "int", nullable: true),
                    UserId = table.Column<long>(type: "bigint", nullable: false),
                    ClaimType = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
                    ClaimValue = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    CreatorUserId = table.Column<long>(type: "bigint", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_MtUserClaims", x => x.Id);
                    table.ForeignKey(
                        name: "FK_MtUserClaims_MtUsers_UserId",
                        column: x => x.UserId,
                        principalTable: "MtUsers",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateTable(
                name: "MtUserLogins",
                columns: table => new
                {
                    Id = table.Column<long>(type: "bigint", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    TenantId = table.Column<int>(type: "int", nullable: true),
                    UserId = table.Column<long>(type: "bigint", nullable: false),
                    LoginProvider = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: false),
                    ProviderKey = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_MtUserLogins", x => x.Id);
                    table.ForeignKey(
                        name: "FK_MtUserLogins_MtUsers_UserId",
                        column: x => x.UserId,
                        principalTable: "MtUsers",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateTable(
                name: "MtUserOrganizationUnits",
                columns: table => new
                {
                    Id = table.Column<long>(type: "bigint", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    TenantId = table.Column<int>(type: "int", nullable: true),
                    UserId = table.Column<long>(type: "bigint", nullable: false),
                    OrganizationUnitId = table.Column<long>(type: "bigint", nullable: false),
                    IsDeleted = table.Column<bool>(type: "bit", nullable: false),
                    CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    CreatorUserId = table.Column<long>(type: "bigint", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_MtUserOrganizationUnits", x => x.Id);
                    table.ForeignKey(
                        name: "FK_MtUserOrganizationUnits_MtUsers_UserId",
                        column: x => x.UserId,
                        principalTable: "MtUsers",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateTable(
                name: "MtUserRoles",
                columns: table => new
                {
                    Id = table.Column<long>(type: "bigint", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    TenantId = table.Column<int>(type: "int", nullable: true),
                    UserId = table.Column<long>(type: "bigint", nullable: false),
                    RoleId = table.Column<int>(type: "int", nullable: false),
                    CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    CreatorUserId = table.Column<long>(type: "bigint", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_MtUserRoles", x => x.Id);
                    table.ForeignKey(
                        name: "FK_MtUserRoles_MtUsers_UserId",
                        column: x => x.UserId,
                        principalTable: "MtUsers",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateTable(
                name: "MtUserTokens",
                columns: table => new
                {
                    Id = table.Column<long>(type: "bigint", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    TenantId = table.Column<int>(type: "int", nullable: true),
                    UserId = table.Column<long>(type: "bigint", nullable: false),
                    LoginProvider = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: true),
                    Name = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: true),
                    Value = table.Column<string>(type: "nvarchar(512)", maxLength: 512, nullable: true),
                    ExpireDate = table.Column<DateTime>(type: "datetime2", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_MtUserTokens", x => x.Id);
                    table.ForeignKey(
                        name: "FK_MtUserTokens_MtUsers_UserId",
                        column: x => x.UserId,
                        principalTable: "MtUsers",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateTable(
                name: "MtWebhookSendAttempts",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    WebhookEventId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    WebhookSubscriptionId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    Response = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    ResponseStatusCode = table.Column<int>(type: "int", nullable: true),
                    CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    TenantId = table.Column<int>(type: "int", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_MtWebhookSendAttempts", x => x.Id);
                    table.ForeignKey(
                        name: "FK_MtWebhookSendAttempts_MtWebhookEvents_WebhookEventId",
                        column: x => x.WebhookEventId,
                        principalTable: "MtWebhookEvents",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateTable(
                name: "MtDynamicEntityPropertyValues",
                columns: table => new
                {
                    Id = table.Column<long>(type: "bigint", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    Value = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    EntityId = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    DynamicEntityPropertyId = table.Column<int>(type: "int", nullable: false),
                    TenantId = table.Column<int>(type: "int", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_MtDynamicEntityPropertyValues", x => x.Id);
                    table.ForeignKey(
                        name: "FK_MtDynamicEntityPropertyValues_MtDynamicEntityProperties_DynamicEntityPropertyId",
                        column: x => x.DynamicEntityPropertyId,
                        principalTable: "MtDynamicEntityProperties",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateTable(
                name: "MtEntityPropertyChanges",
                columns: table => new
                {
                    Id = table.Column<long>(type: "bigint", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    EntityChangeId = table.Column<long>(type: "bigint", nullable: false),
                    NewValue = table.Column<string>(type: "nvarchar(512)", maxLength: 512, nullable: true),
                    OriginalValue = table.Column<string>(type: "nvarchar(512)", maxLength: 512, nullable: true),
                    PropertyName = table.Column<string>(type: "nvarchar(96)", maxLength: 96, nullable: true),
                    PropertyTypeFullName = table.Column<string>(type: "nvarchar(192)", maxLength: 192, nullable: true),
                    TenantId = table.Column<int>(type: "int", nullable: true),
                    NewValueHash = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    OriginalValueHash = table.Column<string>(type: "nvarchar(max)", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_MtEntityPropertyChanges", x => x.Id);
                    table.ForeignKey(
                        name: "FK_MtEntityPropertyChanges_MtEntityChanges_EntityChangeId",
                        column: x => x.EntityChangeId,
                        principalTable: "MtEntityChanges",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateTable(
                name: "MtPermissions",
                columns: table => new
                {
                    Id = table.Column<long>(type: "bigint", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    TenantId = table.Column<int>(type: "int", nullable: true),
                    Name = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: false),
                    IsGranted = table.Column<bool>(type: "bit", nullable: false),
                    Discriminator = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
                    RoleId = table.Column<int>(type: "int", nullable: true),
                    Type = table.Column<int>(type: "int", nullable: true),
                    UserId = table.Column<long>(type: "bigint", nullable: true),
                    UserPermission_Type = table.Column<int>(type: "int", nullable: true),
                    CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    CreatorUserId = table.Column<long>(type: "bigint", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_MtPermissions", x => x.Id);
                    table.ForeignKey(
                        name: "FK_MtPermissions_MtRoles_RoleId",
                        column: x => x.RoleId,
                        principalTable: "MtRoles",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_MtPermissions_MtUsers_UserId",
                        column: x => x.UserId,
                        principalTable: "MtUsers",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateTable(
                name: "MtRoleClaims",
                columns: table => new
                {
                    Id = table.Column<long>(type: "bigint", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    TenantId = table.Column<int>(type: "int", nullable: true),
                    RoleId = table.Column<int>(type: "int", nullable: false),
                    ClaimType = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
                    ClaimValue = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    CreatorUserId = table.Column<long>(type: "bigint", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_MtRoleClaims", x => x.Id);
                    table.ForeignKey(
                        name: "FK_MtRoleClaims_MtRoles_RoleId",
                        column: x => x.RoleId,
                        principalTable: "MtRoles",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateIndex(
                name: "IX_AbpPersistedGrants_Expiration",
                table: "AbpPersistedGrants",
                column: "Expiration");

            migrationBuilder.CreateIndex(
                name: "IX_AbpPersistedGrants_SubjectId_ClientId_Type",
                table: "AbpPersistedGrants",
                columns: new[] { "SubjectId", "ClientId", "Type" });

            migrationBuilder.CreateIndex(
                name: "IX_AbpPersistedGrants_SubjectId_SessionId_Type",
                table: "AbpPersistedGrants",
                columns: new[] { "SubjectId", "SessionId", "Type" });

            migrationBuilder.CreateIndex(
                name: "IX_AppAccessData_Acount",
                table: "AppAccessData",
                column: "Acount");

            migrationBuilder.CreateIndex(
                name: "IX_AppBackupBody_ContentId",
                table: "AppBackupBody",
                column: "ContentId");

            migrationBuilder.CreateIndex(
                name: "IX_AppBackupField_ContentId",
                table: "AppBackupField",
                column: "ContentId");

            migrationBuilder.CreateIndex(
                name: "IX_AppBinaryObjects_TenantId",
                table: "AppBinaryObjects",
                column: "TenantId");

            migrationBuilder.CreateIndex(
                name: "IX_AppBundlings_MenuId",
                table: "AppBundlings",
                column: "MenuId");

            migrationBuilder.CreateIndex(
                name: "IX_AppChannelObjects_MenuId",
                table: "AppChannelObjects",
                column: "MenuId");

            migrationBuilder.CreateIndex(
                name: "IX_AppCommonShortMsg_CreatorUserId",
                table: "AppCommonShortMsg",
                column: "CreatorUserId");

            migrationBuilder.CreateIndex(
                name: "IX_AppContent_TenantId_Language_AuxiliaryId",
                table: "AppContent",
                columns: new[] { "TenantId", "Language", "AuxiliaryId" });

            migrationBuilder.CreateIndex(
                name: "IX_AppContent_TenantId_Language_IsActive",
                table: "AppContent",
                columns: new[] { "TenantId", "Language", "IsActive" });

            migrationBuilder.CreateIndex(
                name: "IX_AppContent_TenantId_Language_MenuId_RelateId_IsActive_Order",
                table: "AppContent",
                columns: new[] { "TenantId", "Language", "MenuId", "RelateId", "IsActive", "Order" });

            migrationBuilder.CreateIndex(
                name: "IX_AppContent_TenantId_Language_MenuId_RelateId_Key_IsActive",
                table: "AppContent",
                columns: new[] { "TenantId", "Language", "MenuId", "RelateId", "Key", "IsActive" });

            migrationBuilder.CreateIndex(
                name: "IX_AppContentBody_ContentId",
                table: "AppContentBody",
                column: "ContentId");

            migrationBuilder.CreateIndex(
                name: "IX_AppContentField_ContentId",
                table: "AppContentField",
                column: "ContentId");

            migrationBuilder.CreateIndex(
                name: "IX_AppContentMenus_ContentId",
                table: "AppContentMenus",
                column: "ContentId");

            migrationBuilder.CreateIndex(
                name: "IX_AppContentMenus_MenuId_RelateId_Order_ContentId",
                table: "AppContentMenus",
                columns: new[] { "MenuId", "RelateId", "Order", "ContentId" });

            migrationBuilder.CreateIndex(
                name: "IX_AppContentMenus_MenuId_RelateId_PublishTime_ContentId",
                table: "AppContentMenus",
                columns: new[] { "MenuId", "RelateId", "PublishTime", "ContentId" });

            migrationBuilder.CreateIndex(
                name: "IX_AppContentStorages_TenantId_ContentId",
                table: "AppContentStorages",
                columns: new[] { "TenantId", "ContentId" });

            migrationBuilder.CreateIndex(
                name: "IX_AppDirectories_TenantId_ParentId_Owners",
                table: "AppDirectories",
                columns: new[] { "TenantId", "ParentId", "Owners" });

            migrationBuilder.CreateIndex(
                name: "IX_AppFileLibrary_DirectoryId_CreationTime",
                table: "AppFileLibrary",
                columns: new[] { "DirectoryId", "CreationTime" });

            migrationBuilder.CreateIndex(
                name: "IX_AppFileLibrary_FileUrl",
                table: "AppFileLibrary",
                column: "FileUrl");

            migrationBuilder.CreateIndex(
                name: "IX_AppFileLibrary_Sha1",
                table: "AppFileLibrary",
                column: "Sha1");

            migrationBuilder.CreateIndex(
                name: "IX_AppFileObjectEx_OriginFileUrl",
                table: "AppFileObjectEx",
                column: "OriginFileUrl");

            migrationBuilder.CreateIndex(
                name: "IX_AppFileObjects_FileUrl",
                table: "AppFileObjects",
                column: "FileUrl");

            migrationBuilder.CreateIndex(
                name: "IX_AppFileObjects_IsTemporary",
                table: "AppFileObjects",
                column: "IsTemporary");

            migrationBuilder.CreateIndex(
                name: "IX_AppFileObjects_Sha1",
                table: "AppFileObjects",
                column: "Sha1");

            migrationBuilder.CreateIndex(
                name: "IX_AppFileObjects_TenantId_Language_ContentId",
                table: "AppFileObjects",
                columns: new[] { "TenantId", "Language", "ContentId" });

            migrationBuilder.CreateIndex(
                name: "IX_AppFrontEndPages_BackEndModuleId",
                table: "AppFrontEndPages",
                column: "BackEndModuleId");

            migrationBuilder.CreateIndex(
                name: "IX_AppMemberInfo_TenantId_Language_MemberID",
                table: "AppMemberInfo",
                columns: new[] { "TenantId", "Language", "MemberID" });

            migrationBuilder.CreateIndex(
                name: "IX_AppMenuConfigs_TenantId_MenuId",
                table: "AppMenuConfigs",
                columns: new[] { "TenantId", "MenuId" });

            migrationBuilder.CreateIndex(
                name: "IX_AppMenus_TenantId_AuxiliaryId",
                table: "AppMenus",
                columns: new[] { "TenantId", "AuxiliaryId" });

            migrationBuilder.CreateIndex(
                name: "IX_AppMenus_TenantId_Code",
                table: "AppMenus",
                columns: new[] { "TenantId", "Code" });

            migrationBuilder.CreateIndex(
                name: "IX_AppMessages_TenantId_Language_AuxiliaryId",
                table: "AppMessages",
                columns: new[] { "TenantId", "Language", "AuxiliaryId" });

            migrationBuilder.CreateIndex(
                name: "IX_AppMessages_TenantId_Language_MenuId",
                table: "AppMessages",
                columns: new[] { "TenantId", "Language", "MenuId" });

            migrationBuilder.CreateIndex(
                name: "IX_AppPageViews_FrontEndPageId",
                table: "AppPageViews",
                column: "FrontEndPageId");

            migrationBuilder.CreateIndex(
                name: "IX_AppPeriodicBackgroundJobLogs_Date",
                table: "AppPeriodicBackgroundJobLogs",
                column: "Date");

            migrationBuilder.CreateIndex(
                name: "IX_AppPost_TenantId_OrganizationId",
                table: "AppPost",
                columns: new[] { "TenantId", "OrganizationId" });

            migrationBuilder.CreateIndex(
                name: "IX_AppPostOrganization_PostId",
                table: "AppPostOrganization",
                column: "PostId");

            migrationBuilder.CreateIndex(
                name: "IX_AppPostOrganization_TenantId_OrganizationId",
                table: "AppPostOrganization",
                columns: new[] { "TenantId", "OrganizationId" });

            migrationBuilder.CreateIndex(
                name: "IX_AppPostOrganization_TenantId_PostId",
                table: "AppPostOrganization",
                columns: new[] { "TenantId", "PostId" });

            migrationBuilder.CreateIndex(
                name: "IX_AppRouteSettings_TenantId_RelatedId",
                table: "AppRouteSettings",
                columns: new[] { "TenantId", "RelatedId" });

            migrationBuilder.CreateIndex(
                name: "IX_AppTaxonomysItem_Code",
                table: "AppTaxonomysItem",
                column: "Code");

            migrationBuilder.CreateIndex(
                name: "IX_AppTaxonomysItemBind_TenantId",
                table: "AppTaxonomysItemBind",
                column: "TenantId");

            migrationBuilder.CreateIndex(
                name: "IX_AppTemporaryFile_FileUrl",
                table: "AppTemporaryFile",
                column: "FileUrl");

            migrationBuilder.CreateIndex(
                name: "IX_AppUserPost_TenantId_PostId",
                table: "AppUserPost",
                columns: new[] { "TenantId", "PostId" });

            migrationBuilder.CreateIndex(
                name: "IX_AppUserPost_TenantId_UserId",
                table: "AppUserPost",
                columns: new[] { "TenantId", "UserId" });

            migrationBuilder.CreateIndex(
                name: "IX_AppVerifyCode_TenantId_AuxiliaryId",
                table: "AppVerifyCode",
                columns: new[] { "TenantId", "AuxiliaryId" });

            migrationBuilder.CreateIndex(
                name: "IX_AppVersionInfo_ContentId",
                table: "AppVersionInfo",
                column: "ContentId");

            migrationBuilder.CreateIndex(
                name: "IX_AppWorkFlowForm_TenantId_WorkFlowId",
                table: "AppWorkFlowForm",
                columns: new[] { "TenantId", "WorkFlowId" });

            migrationBuilder.CreateIndex(
                name: "IX_AppWorkFlowLogs_PaperId",
                table: "AppWorkFlowLogs",
                column: "PaperId");

            migrationBuilder.CreateIndex(
                name: "IX_AppWorkFlowNode_TenantId_WorkflowId",
                table: "AppWorkFlowNode",
                columns: new[] { "TenantId", "WorkflowId" });

            migrationBuilder.CreateIndex(
                name: "IX_AppWorkFlowPaper_PaperState_WorkFlowId_CreationTime",
                table: "AppWorkFlowPaper",
                columns: new[] { "PaperState", "WorkFlowId", "CreationTime" });

            migrationBuilder.CreateIndex(
                name: "IX_AppWorkFlowPaper_ReferNumber",
                table: "AppWorkFlowPaper",
                column: "ReferNumber");

            migrationBuilder.CreateIndex(
                name: "IX_AppWorkFlowPaperArchive_CreationTime",
                table: "AppWorkFlowPaperArchive",
                column: "CreationTime");

            migrationBuilder.CreateIndex(
                name: "IX_AppWorkFlowPaperArchive_WorkFlowId_CreationTime",
                table: "AppWorkFlowPaperArchive",
                columns: new[] { "WorkFlowId", "CreationTime" });

            migrationBuilder.CreateIndex(
                name: "IX_AppWorkFlowPaperData_PaperId",
                table: "AppWorkFlowPaperData",
                column: "PaperId");

            migrationBuilder.CreateIndex(
                name: "IX_AppWorkFlowPaperListCtrlData_RelateId",
                table: "AppWorkFlowPaperListCtrlData",
                column: "RelateId");

            migrationBuilder.CreateIndex(
                name: "IX_AppWorkFlowProcess_PaperId",
                table: "AppWorkFlowProcess",
                column: "PaperId");

            migrationBuilder.CreateIndex(
                name: "IX_AppWorkFlowProcess_State_UserId_StartTime",
                table: "AppWorkFlowProcess",
                columns: new[] { "State", "UserId", "StartTime" });

            migrationBuilder.CreateIndex(
                name: "IX_AppWorkFlowProcessMsg_PaperId",
                table: "AppWorkFlowProcessMsg",
                column: "PaperId");

            migrationBuilder.CreateIndex(
                name: "IX_AppWorkFlowRelationship_PaperId",
                table: "AppWorkFlowRelationship",
                column: "PaperId");

            migrationBuilder.CreateIndex(
                name: "IX_AppWorkFlowRunTime_PaperId",
                table: "AppWorkFlowRunTime",
                column: "PaperId");

            migrationBuilder.CreateIndex(
                name: "IX_AppWorkFlowRunTime_UserId_State_StartTime_PaperId",
                table: "AppWorkFlowRunTime",
                columns: new[] { "UserId", "State", "StartTime", "PaperId" });

            migrationBuilder.CreateIndex(
                name: "IX_MtAuditLogs_TenantId_ExecutionDuration",
                table: "MtAuditLogs",
                columns: new[] { "TenantId", "ExecutionDuration" });

            migrationBuilder.CreateIndex(
                name: "IX_MtAuditLogs_TenantId_ExecutionTime",
                table: "MtAuditLogs",
                columns: new[] { "TenantId", "ExecutionTime" });

            migrationBuilder.CreateIndex(
                name: "IX_MtAuditLogs_TenantId_UserId",
                table: "MtAuditLogs",
                columns: new[] { "TenantId", "UserId" });

            migrationBuilder.CreateIndex(
                name: "IX_MtBackgroundJobs_IsAbandoned_NextTryTime",
                table: "MtBackgroundJobs",
                columns: new[] { "IsAbandoned", "NextTryTime" });

            migrationBuilder.CreateIndex(
                name: "IX_MtCacheBackUp_DataId",
                table: "MtCacheBackUp",
                column: "DataId");

            migrationBuilder.CreateIndex(
                name: "IX_MtCacheBackUp_DataType",
                table: "MtCacheBackUp",
                column: "DataType");

            migrationBuilder.CreateIndex(
                name: "IX_MtChatMessages_TargetTenantId_TargetUserId_ReadState",
                table: "MtChatMessages",
                columns: new[] { "TargetTenantId", "TargetUserId", "ReadState" });

            migrationBuilder.CreateIndex(
                name: "IX_MtChatMessages_TargetTenantId_UserId_ReadState",
                table: "MtChatMessages",
                columns: new[] { "TargetTenantId", "UserId", "ReadState" });

            migrationBuilder.CreateIndex(
                name: "IX_MtChatMessages_TenantId_TargetUserId_ReadState",
                table: "MtChatMessages",
                columns: new[] { "TenantId", "TargetUserId", "ReadState" });

            migrationBuilder.CreateIndex(
                name: "IX_MtChatMessages_TenantId_UserId_ReadState",
                table: "MtChatMessages",
                columns: new[] { "TenantId", "UserId", "ReadState" });

            migrationBuilder.CreateIndex(
                name: "IX_MtDynamicEntityProperties_DynamicPropertyId",
                table: "MtDynamicEntityProperties",
                column: "DynamicPropertyId");

            migrationBuilder.CreateIndex(
                name: "IX_MtDynamicEntityProperties_EntityFullName_DynamicPropertyId_TenantId",
                table: "MtDynamicEntityProperties",
                columns: new[] { "EntityFullName", "DynamicPropertyId", "TenantId" },
                unique: true,
                filter: "[EntityFullName] IS NOT NULL AND [TenantId] IS NOT NULL");

            migrationBuilder.CreateIndex(
                name: "IX_MtDynamicEntityPropertyValues_DynamicEntityPropertyId",
                table: "MtDynamicEntityPropertyValues",
                column: "DynamicEntityPropertyId");

            migrationBuilder.CreateIndex(
                name: "IX_MtDynamicProperties_PropertyName_TenantId",
                table: "MtDynamicProperties",
                columns: new[] { "PropertyName", "TenantId" },
                unique: true,
                filter: "[PropertyName] IS NOT NULL AND [TenantId] IS NOT NULL");

            migrationBuilder.CreateIndex(
                name: "IX_MtDynamicPropertyValues_DynamicPropertyId",
                table: "MtDynamicPropertyValues",
                column: "DynamicPropertyId");

            migrationBuilder.CreateIndex(
                name: "IX_MtEntityChanges_EntityChangeSetId",
                table: "MtEntityChanges",
                column: "EntityChangeSetId");

            migrationBuilder.CreateIndex(
                name: "IX_MtEntityChanges_EntityTypeFullName_EntityId",
                table: "MtEntityChanges",
                columns: new[] { "EntityTypeFullName", "EntityId" });

            migrationBuilder.CreateIndex(
                name: "IX_MtEntityChangeSets_TenantId_CreationTime",
                table: "MtEntityChangeSets",
                columns: new[] { "TenantId", "CreationTime" });

            migrationBuilder.CreateIndex(
                name: "IX_MtEntityChangeSets_TenantId_Reason",
                table: "MtEntityChangeSets",
                columns: new[] { "TenantId", "Reason" });

            migrationBuilder.CreateIndex(
                name: "IX_MtEntityChangeSets_TenantId_UserId",
                table: "MtEntityChangeSets",
                columns: new[] { "TenantId", "UserId" });

            migrationBuilder.CreateIndex(
                name: "IX_MtEntityPropertyChanges_EntityChangeId",
                table: "MtEntityPropertyChanges",
                column: "EntityChangeId");

            migrationBuilder.CreateIndex(
                name: "IX_MtFeatures_EditionId_Name",
                table: "MtFeatures",
                columns: new[] { "EditionId", "Name" });

            migrationBuilder.CreateIndex(
                name: "IX_MtFeatures_TenantId_Name",
                table: "MtFeatures",
                columns: new[] { "TenantId", "Name" });

            migrationBuilder.CreateIndex(
                name: "IX_MtFriendships_FriendTenantId_FriendUserId",
                table: "MtFriendships",
                columns: new[] { "FriendTenantId", "FriendUserId" });

            migrationBuilder.CreateIndex(
                name: "IX_MtFriendships_FriendTenantId_UserId",
                table: "MtFriendships",
                columns: new[] { "FriendTenantId", "UserId" });

            migrationBuilder.CreateIndex(
                name: "IX_MtFriendships_TenantId_FriendUserId",
                table: "MtFriendships",
                columns: new[] { "TenantId", "FriendUserId" });

            migrationBuilder.CreateIndex(
                name: "IX_MtFriendships_TenantId_UserId",
                table: "MtFriendships",
                columns: new[] { "TenantId", "UserId" });

            migrationBuilder.CreateIndex(
                name: "IX_MtLanguages_TenantId_Name",
                table: "MtLanguages",
                columns: new[] { "TenantId", "Name" });

            migrationBuilder.CreateIndex(
                name: "IX_MtLanguageTexts_TenantId_Source_LanguageName_Key",
                table: "MtLanguageTexts",
                columns: new[] { "TenantId", "Source", "LanguageName", "Key" });

            migrationBuilder.CreateIndex(
                name: "IX_MtNotificationSubscriptions_NotificationName_EntityTypeName_EntityId_UserId",
                table: "MtNotificationSubscriptions",
                columns: new[] { "NotificationName", "EntityTypeName", "EntityId", "UserId" });

            migrationBuilder.CreateIndex(
                name: "IX_MtNotificationSubscriptions_TenantId_NotificationName_EntityTypeName_EntityId_UserId",
                table: "MtNotificationSubscriptions",
                columns: new[] { "TenantId", "NotificationName", "EntityTypeName", "EntityId", "UserId" });

            migrationBuilder.CreateIndex(
                name: "IX_MtOrganizationUnitRoles_TenantId_OrganizationUnitId",
                table: "MtOrganizationUnitRoles",
                columns: new[] { "TenantId", "OrganizationUnitId" });

            migrationBuilder.CreateIndex(
                name: "IX_MtOrganizationUnitRoles_TenantId_RoleId",
                table: "MtOrganizationUnitRoles",
                columns: new[] { "TenantId", "RoleId" });

            migrationBuilder.CreateIndex(
                name: "IX_MtOrganizationUnits_ParentId",
                table: "MtOrganizationUnits",
                column: "ParentId");

            migrationBuilder.CreateIndex(
                name: "IX_MtOrganizationUnits_TenantId_Code",
                table: "MtOrganizationUnits",
                columns: new[] { "TenantId", "Code" });

            migrationBuilder.CreateIndex(
                name: "IX_MtPermissions_RoleId",
                table: "MtPermissions",
                column: "RoleId");

            migrationBuilder.CreateIndex(
                name: "IX_MtPermissions_TenantId_Name",
                table: "MtPermissions",
                columns: new[] { "TenantId", "Name" });

            migrationBuilder.CreateIndex(
                name: "IX_MtPermissions_UserId",
                table: "MtPermissions",
                column: "UserId");

            migrationBuilder.CreateIndex(
                name: "IX_MtRoleClaims_RoleId",
                table: "MtRoleClaims",
                column: "RoleId");

            migrationBuilder.CreateIndex(
                name: "IX_MtRoleClaims_TenantId_ClaimType",
                table: "MtRoleClaims",
                columns: new[] { "TenantId", "ClaimType" });

            migrationBuilder.CreateIndex(
                name: "IX_MtRoles_CreatorUserId",
                table: "MtRoles",
                column: "CreatorUserId");

            migrationBuilder.CreateIndex(
                name: "IX_MtRoles_DeleterUserId",
                table: "MtRoles",
                column: "DeleterUserId");

            migrationBuilder.CreateIndex(
                name: "IX_MtRoles_LastModifierUserId",
                table: "MtRoles",
                column: "LastModifierUserId");

            migrationBuilder.CreateIndex(
                name: "IX_MtRoles_TenantId_NormalizedName",
                table: "MtRoles",
                columns: new[] { "TenantId", "NormalizedName" });

            migrationBuilder.CreateIndex(
                name: "IX_MtSeos_TenantId_RelatedId",
                table: "MtSeos",
                columns: new[] { "TenantId", "RelatedId" });

            migrationBuilder.CreateIndex(
                name: "IX_MtSettings_TenantId_Name_UserId",
                table: "MtSettings",
                columns: new[] { "TenantId", "Name", "UserId" },
                unique: true);

            migrationBuilder.CreateIndex(
                name: "IX_MtSettings_UserId",
                table: "MtSettings",
                column: "UserId");

            migrationBuilder.CreateIndex(
                name: "IX_MtShortIds_AuxiliaryId",
                table: "MtShortIds",
                column: "AuxiliaryId");

            migrationBuilder.CreateIndex(
                name: "IX_MtStaticPages_RealUrl",
                table: "MtStaticPages",
                column: "RealUrl");

            migrationBuilder.CreateIndex(
                name: "IX_MtTenantNotifications_TenantId",
                table: "MtTenantNotifications",
                column: "TenantId");

            migrationBuilder.CreateIndex(
                name: "IX_MtTenantNotifications_TenantId_NotificationName_EntityId",
                table: "MtTenantNotifications",
                columns: new[] { "TenantId", "NotificationName", "EntityId" });

            migrationBuilder.CreateIndex(
                name: "IX_MtTenants_CreatorUserId",
                table: "MtTenants",
                column: "CreatorUserId");

            migrationBuilder.CreateIndex(
                name: "IX_MtTenants_DeleterUserId",
                table: "MtTenants",
                column: "DeleterUserId");

            migrationBuilder.CreateIndex(
                name: "IX_MtTenants_EditionId",
                table: "MtTenants",
                column: "EditionId");

            migrationBuilder.CreateIndex(
                name: "IX_MtTenants_LastModifierUserId",
                table: "MtTenants",
                column: "LastModifierUserId");

            migrationBuilder.CreateIndex(
                name: "IX_MtTenants_TenancyName",
                table: "MtTenants",
                column: "TenancyName");

            migrationBuilder.CreateIndex(
                name: "IX_MtUserAccounts_EmailAddress",
                table: "MtUserAccounts",
                column: "EmailAddress");

            migrationBuilder.CreateIndex(
                name: "IX_MtUserAccounts_TenantId_EmailAddress",
                table: "MtUserAccounts",
                columns: new[] { "TenantId", "EmailAddress" });

            migrationBuilder.CreateIndex(
                name: "IX_MtUserAccounts_TenantId_UserId",
                table: "MtUserAccounts",
                columns: new[] { "TenantId", "UserId" });

            migrationBuilder.CreateIndex(
                name: "IX_MtUserAccounts_TenantId_UserName",
                table: "MtUserAccounts",
                columns: new[] { "TenantId", "UserName" });

            migrationBuilder.CreateIndex(
                name: "IX_MtUserAccounts_UserName",
                table: "MtUserAccounts",
                column: "UserName");

            migrationBuilder.CreateIndex(
                name: "IX_MtUserClaims_TenantId_ClaimType",
                table: "MtUserClaims",
                columns: new[] { "TenantId", "ClaimType" });

            migrationBuilder.CreateIndex(
                name: "IX_MtUserClaims_UserId",
                table: "MtUserClaims",
                column: "UserId");

            migrationBuilder.CreateIndex(
                name: "IX_MtUserDelegations_TenantId_SourceUserId",
                table: "MtUserDelegations",
                columns: new[] { "TenantId", "SourceUserId" });

            migrationBuilder.CreateIndex(
                name: "IX_MtUserDelegations_TenantId_TargetUserId",
                table: "MtUserDelegations",
                columns: new[] { "TenantId", "TargetUserId" });

            migrationBuilder.CreateIndex(
                name: "IX_MtUserExtension_UserId",
                table: "MtUserExtension",
                column: "UserId");

            migrationBuilder.CreateIndex(
                name: "IX_MtUserLoginAttempts_TenancyName_UserNameOrEmailAddress_Result",
                table: "MtUserLoginAttempts",
                columns: new[] { "TenancyName", "UserNameOrEmailAddress", "Result" });

            migrationBuilder.CreateIndex(
                name: "IX_MtUserLoginAttempts_UserId_TenantId",
                table: "MtUserLoginAttempts",
                columns: new[] { "UserId", "TenantId" });

            migrationBuilder.CreateIndex(
                name: "IX_MtUserLogins_ProviderKey_TenantId",
                table: "MtUserLogins",
                columns: new[] { "ProviderKey", "TenantId" },
                unique: true,
                filter: "[TenantId] IS NOT NULL");

            migrationBuilder.CreateIndex(
                name: "IX_MtUserLogins_TenantId_LoginProvider_ProviderKey",
                table: "MtUserLogins",
                columns: new[] { "TenantId", "LoginProvider", "ProviderKey" });

            migrationBuilder.CreateIndex(
                name: "IX_MtUserLogins_TenantId_UserId",
                table: "MtUserLogins",
                columns: new[] { "TenantId", "UserId" });

            migrationBuilder.CreateIndex(
                name: "IX_MtUserLogins_UserId",
                table: "MtUserLogins",
                column: "UserId");

            migrationBuilder.CreateIndex(
                name: "IX_MtUserNotifications_UserId_State_CreationTime",
                table: "MtUserNotifications",
                columns: new[] { "UserId", "State", "CreationTime" });

            migrationBuilder.CreateIndex(
                name: "IX_MtUserOrganizationUnits_TenantId_OrganizationUnitId",
                table: "MtUserOrganizationUnits",
                columns: new[] { "TenantId", "OrganizationUnitId" });

            migrationBuilder.CreateIndex(
                name: "IX_MtUserOrganizationUnits_TenantId_UserId",
                table: "MtUserOrganizationUnits",
                columns: new[] { "TenantId", "UserId" });

            migrationBuilder.CreateIndex(
                name: "IX_MtUserOrganizationUnits_UserId",
                table: "MtUserOrganizationUnits",
                column: "UserId");

            migrationBuilder.CreateIndex(
                name: "IX_MtUserRoles_TenantId_RoleId",
                table: "MtUserRoles",
                columns: new[] { "TenantId", "RoleId" });

            migrationBuilder.CreateIndex(
                name: "IX_MtUserRoles_TenantId_UserId",
                table: "MtUserRoles",
                columns: new[] { "TenantId", "UserId" });

            migrationBuilder.CreateIndex(
                name: "IX_MtUserRoles_UserId",
                table: "MtUserRoles",
                column: "UserId");

            migrationBuilder.CreateIndex(
                name: "IX_MtUsers_CreatorUserId",
                table: "MtUsers",
                column: "CreatorUserId");

            migrationBuilder.CreateIndex(
                name: "IX_MtUsers_DeleterUserId",
                table: "MtUsers",
                column: "DeleterUserId");

            migrationBuilder.CreateIndex(
                name: "IX_MtUsers_LastModifierUserId",
                table: "MtUsers",
                column: "LastModifierUserId");

            migrationBuilder.CreateIndex(
                name: "IX_MtUsers_TenantId_NormalizedEmailAddress",
                table: "MtUsers",
                columns: new[] { "TenantId", "NormalizedEmailAddress" });

            migrationBuilder.CreateIndex(
                name: "IX_MtUsers_TenantId_NormalizedUserName",
                table: "MtUsers",
                columns: new[] { "TenantId", "NormalizedUserName" });

            migrationBuilder.CreateIndex(
                name: "IX_MtUserTokens_TenantId_UserId",
                table: "MtUserTokens",
                columns: new[] { "TenantId", "UserId" });

            migrationBuilder.CreateIndex(
                name: "IX_MtUserTokens_UserId",
                table: "MtUserTokens",
                column: "UserId");

            migrationBuilder.CreateIndex(
                name: "IX_MtWebhookSendAttempts_WebhookEventId",
                table: "MtWebhookSendAttempts",
                column: "WebhookEventId");
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "AbpPersistedGrants");

            migrationBuilder.DropTable(
                name: "AppAccessData");

            migrationBuilder.DropTable(
                name: "AppAccessGeneral");

            migrationBuilder.DropTable(
                name: "AppBackEndModules");

            migrationBuilder.DropTable(
                name: "AppBackupBody");

            migrationBuilder.DropTable(
                name: "AppBackupField");

            migrationBuilder.DropTable(
                name: "AppBinaryObjects");

            migrationBuilder.DropTable(
                name: "AppBundlings");

            migrationBuilder.DropTable(
                name: "AppChannelObjects");

            migrationBuilder.DropTable(
                name: "AppCommonShortMsg");

            migrationBuilder.DropTable(
                name: "AppContent");

            migrationBuilder.DropTable(
                name: "AppContentBody");

            migrationBuilder.DropTable(
                name: "AppContentField");

            migrationBuilder.DropTable(
                name: "AppContentMenus");

            migrationBuilder.DropTable(
                name: "AppContentStorages");

            migrationBuilder.DropTable(
                name: "AppDataLog");

            migrationBuilder.DropTable(
                name: "AppDirectories");

            migrationBuilder.DropTable(
                name: "AppFileLibrary");

            migrationBuilder.DropTable(
                name: "AppFileObjectEx");

            migrationBuilder.DropTable(
                name: "AppFileObjects");

            migrationBuilder.DropTable(
                name: "AppIPInfos");

            migrationBuilder.DropTable(
                name: "AppMember");

            migrationBuilder.DropTable(
                name: "AppMemberInfo");

            migrationBuilder.DropTable(
                name: "AppMenuConfigs");

            migrationBuilder.DropTable(
                name: "AppMessages");

            migrationBuilder.DropTable(
                name: "AppPageViews");

            migrationBuilder.DropTable(
                name: "AppPeriodicBackgroundJobLogs");

            migrationBuilder.DropTable(
                name: "AppPostOrganization");

            migrationBuilder.DropTable(
                name: "AppRouteSettings");

            migrationBuilder.DropTable(
                name: "AppTaxonomys");

            migrationBuilder.DropTable(
                name: "AppTaxonomysItem");

            migrationBuilder.DropTable(
                name: "AppTaxonomysItemBind");

            migrationBuilder.DropTable(
                name: "AppTemporaryFile");

            migrationBuilder.DropTable(
                name: "AppUserPost");

            migrationBuilder.DropTable(
                name: "AppVerifyCode");

            migrationBuilder.DropTable(
                name: "AppVersionInfo");

            migrationBuilder.DropTable(
                name: "AppWorkFlow");

            migrationBuilder.DropTable(
                name: "AppWorkFlowCategeory");

            migrationBuilder.DropTable(
                name: "AppWorkFlowForm");

            migrationBuilder.DropTable(
                name: "AppWorkFlowLogs");

            migrationBuilder.DropTable(
                name: "AppWorkFlowNode");

            migrationBuilder.DropTable(
                name: "AppWorkFlowPaper");

            migrationBuilder.DropTable(
                name: "AppWorkFlowPaperArchive");

            migrationBuilder.DropTable(
                name: "AppWorkFlowPaperData");

            migrationBuilder.DropTable(
                name: "AppWorkFlowPaperListCtrl");

            migrationBuilder.DropTable(
                name: "AppWorkFlowPaperListCtrlData");

            migrationBuilder.DropTable(
                name: "AppWorkFlowProcess");

            migrationBuilder.DropTable(
                name: "AppWorkFlowProcessMsg");

            migrationBuilder.DropTable(
                name: "AppWorkFlowRelationship");

            migrationBuilder.DropTable(
                name: "AppWorkFlowRunTime");

            migrationBuilder.DropTable(
                name: "MtAuditLogs");

            migrationBuilder.DropTable(
                name: "MtBackgroundJobs");

            migrationBuilder.DropTable(
                name: "MtCacheBackUp");

            migrationBuilder.DropTable(
                name: "MtChatMessages");

            migrationBuilder.DropTable(
                name: "MtCustomConfigurations");

            migrationBuilder.DropTable(
                name: "MtDynamicEntityPropertyValues");

            migrationBuilder.DropTable(
                name: "MtDynamicPropertyValues");

            migrationBuilder.DropTable(
                name: "MtEntityPropertyChanges");

            migrationBuilder.DropTable(
                name: "MtFeatures");

            migrationBuilder.DropTable(
                name: "MtFriendships");

            migrationBuilder.DropTable(
                name: "MtLanguages");

            migrationBuilder.DropTable(
                name: "MtLanguageTexts");

            migrationBuilder.DropTable(
                name: "MtNotifications");

            migrationBuilder.DropTable(
                name: "MtNotificationSubscriptions");

            migrationBuilder.DropTable(
                name: "MtOrganizationUnitRoles");

            migrationBuilder.DropTable(
                name: "MtOrganizationUnits");

            migrationBuilder.DropTable(
                name: "MtPermissions");

            migrationBuilder.DropTable(
                name: "MtRoleClaims");

            migrationBuilder.DropTable(
                name: "MtSeos");

            migrationBuilder.DropTable(
                name: "MtSettings");

            migrationBuilder.DropTable(
                name: "MtShortIds");

            migrationBuilder.DropTable(
                name: "MtStaticPages");

            migrationBuilder.DropTable(
                name: "MtTenantNotifications");

            migrationBuilder.DropTable(
                name: "MtTenants");

            migrationBuilder.DropTable(
                name: "MtUserAccounts");

            migrationBuilder.DropTable(
                name: "MtUserClaims");

            migrationBuilder.DropTable(
                name: "MtUserDelegations");

            migrationBuilder.DropTable(
                name: "MtUserExtension");

            migrationBuilder.DropTable(
                name: "MtUserLoginAttempts");

            migrationBuilder.DropTable(
                name: "MtUserLogins");

            migrationBuilder.DropTable(
                name: "MtUserNotifications");

            migrationBuilder.DropTable(
                name: "MtUserOrganizationUnits");

            migrationBuilder.DropTable(
                name: "MtUserRoles");

            migrationBuilder.DropTable(
                name: "MtUserTokens");

            migrationBuilder.DropTable(
                name: "MtWebhookSendAttempts");

            migrationBuilder.DropTable(
                name: "MtWebhookSubscriptions");

            migrationBuilder.DropTable(
                name: "AppMenus");

            migrationBuilder.DropTable(
                name: "AppFrontEndPages");

            migrationBuilder.DropTable(
                name: "AppPost");

            migrationBuilder.DropTable(
                name: "MtDynamicEntityProperties");

            migrationBuilder.DropTable(
                name: "MtEntityChanges");

            migrationBuilder.DropTable(
                name: "MtRoles");

            migrationBuilder.DropTable(
                name: "MtEditions");

            migrationBuilder.DropTable(
                name: "MtWebhookEvents");

            migrationBuilder.DropTable(
                name: "MtDynamicProperties");

            migrationBuilder.DropTable(
                name: "MtEntityChangeSets");

            migrationBuilder.DropTable(
                name: "MtUsers");
        }
    }
}
